Processing Ajax...

Close Dialog


Close Dialog

Close Dialog

Macro with WinForm

jerone's profile on
Just for fun, I wanted to test if it's possible to open an WinForm from within a marco.

The result is that it does, without any restrictions (maybe a favicon, but even that can be worked around).

I don't know where the test will go to, so I thought I share the code for others to use.
Code can be found here:

I do have some issues/questions:
  • `MacroAPI.ClearClipboard` doesn't seems to do anything.
  • How to detect and show if it's any image? Images are only just added to first beta, but I love to implement a macro function in the test.
  • Which .NET version are the macros running at? Not 4.0 as "Default parameter specifiers are not permitted" I noticed.

I'm running the latest beta (v3.0.0 Beta 3 ~ May 15, 2013).
May 21, 2013 (modified May 29, 2013)  • #1
Keith Lammers (BFS)'s profile on
Very cool! Regarding your questions:
  • The ClearClipboard function only clears the Windows clipboard contents, not the ClipboardFusion History. Are you trying to clear the ClipboardFusion History? If so, I'll add this to our feature request list.
  • There's no way currently to detect from the macro whether the History item is an image, but I'll add that to our feature request list.
  • ClipboardFusion runs in .NET 2.0 for now.

May 29, 2013  • #2
jerone's profile on
Hey Keith. Thnx for replying.
I indeed was under the impression that clear meant the whole CF history records.
Keep up the great work.
May 30, 2013  • #3
Keith Lammers (BFS)'s profile on
No problem! We'll be adding some of your requested functions in the next beta :)
May 31, 2013  • #4
Keith Lammers (BFS)'s profile on
We've just released ClipboardFusion 3.0 Beta 5 (, and we've added the following new MacroAPI Functions:


Jun 6, 2013  • #5
jerone's profile on
Hi Keith,

Thanks for notifying about the new API's. However the new GetHistoryImage function doesn't work as the docs says. When running the example I get the error:


"No overload for method 'GetHistoryImage' takes '2' arguments"

CF is so obfuscated that I can't see what arguments it do need. I'm hoping small bug...

Anyways, about using this, we still don't know if an item at a specific index is just text or an image. To get around this I was thinking about using the following code, but I don't know if this is what was intended:


ImageList imageList = new ImageList();
List<String> textList = new List<String>();
int i = MacroAPI.GetHistoryItemCount();
String textItem;
    // get the text (image may have a name);
    if(MacroAPI.GetHistoryText(i, out textItem)){
    // also check if it is an image;
    Image image;
    if(MacroAPI.GetHistoryImage(i, out image) && image!=null){
Also, the docs doesn't say what GetHistoryImage returns; boolean or just void.

Edit: running the latest beta of course :)
Jun 7, 2013 (modified Jun 7, 2013)  • #6
Keith Lammers (BFS)'s profile on
Sorry about that! It looks like the tool tip and documentation for the GetHistoryImage function was out of date, and will be updated as soon as possible. The syntax for the new function is:


Image GetHistoryImage(int index)

If the Clipboard History Item is not an image, the function will return null, so any null image is considered to be a text item. Here is an example of a function to check if an item is an image or not:


private bool IsClipboardItemAnImage(int index)
  return (MacroAPI.GetHistoryImage(index) != null);

Jun 11, 2013 (modified Jun 11, 2013)  • #7
Was this helpful?  Login to Vote(-)  Login to Vote(-)