Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
Jeff Mason
4 discussion posts
Is it possible (via a macro) to tell ClipboardFusion which item to select by specifying an index?

I'm hoping to replicate some functionality in the clipboard manager app I've been using previously, where you could select an item in the clipboard history and then each time you clicked paste it would move to the next item in the history.

The idea being that you'd copy a number of values from a source document (using separate copy commands to create separate records in the clipboard history), eg

Joe Bloggs
123 My Street
My Town
My Country

And then, when invoking the macro using a hotkey, the first invocation would paste 'Joe Bloggs' and change the selected index to current index + 1. The next invocation would paste '123 My Street', the next would paste 'My Town', etc.
May 28, 2018  • #1
Thomas Malloch (BFS)'s profile on WallpaperFusion.com

There currently isn't any way to set the Clipboard Manager selected index, but I've added this to our feature request list and we'll be sure to let you know if/when we're able to implement it in a future version! In the meantime, I put together two Macros that should do the trick.

The first one, "Set Increment Index and Paste", will save the currently selected index and paste the item you had selected in the Clipboard History. Then you use the second Macro, "Increment Index and Paste" to keep pasting the next Clipboard History item in the list.

Here's how to get them into ClipboardFusion:

  • Download the files attached to this email and repeat the next steps for each file
  • Open the ClipboardFusion Settings window
  • On the "Macros" tab, click the "Import" button
  • Select a file you downloaded in the first step
  • In the window that pops up, you can review the code and assign the Macro a HotKey
  • Click OK to close the Macro Edit window, then OK again to save and apply your changes

I hope this works for you!
• Attachment: Increment Index and Paste.cfmacro [7,776 bytes]
• Attachment: Set Increment Index and Paste.cfmacro [7,880 bytes]
May 30, 2018 (modified May 30, 2018)  • #2
User Image
Jeff Mason
4 discussion posts
Thanks for this Thomas - very useful! :)
May 31, 2018  • #3
User Image
Jeff Mason
4 discussion posts
Any idea when BFS.Window.IsVisible might become available to Clipboard Fusion?

I'm close to getting your scripts to work as a single macro (and thus only one hotkey) by trying to detect if the Clipboard Manager is popped up.

The idea being that in my use case I always initiate the macro from the manager so if I know that's true (ie it's popped up) then the macro should set up the settings index before pasting. If it detects that the manager is not popped up, then it simply increments the index and pastes, etc.

Unfortunately IsVisible is not available yet, and GetFocusedWindow seems to ignore Clipboard Manager (quite reasonably, since 99% of macros probably want to know what the focused window was before the Clipboard Manager popped up!).
May 31, 2018  • #4
Thomas Malloch (BFS)'s profile on WallpaperFusion.com
Nothing like that exists in our functions yet, but I've added your request to our list, and we'll let you know when we implement it! In the meantime, I threw something together that should work for you. Here's the code:

Code

private static bool IsClipboardManagerOpen()
    {
        // Loop through all visible windows and look for a window with the right title that is run by the ClipboardFusion process
        foreach(IntPtr window in BFS.Window.GetVisibleWindowHandles())
        {
            if(BFS.Window.GetText(window).IndexOf("ClipboardFusion", StringComparison.OrdinalIgnoreCase) != 0)
                continue;
            
            if(BFS.Application.GetMainFileByWindow(window).IndexOf("clipboardfusion.exe", StringComparison.OrdinalIgnoreCase) == -1)
                continue;
                
            return true;
        }
        
        // If we got this far, that means we didn't find anything
        return false;
    }


Thanks!
Jun 4, 2018 (modified Jun 4, 2018)  • #5
User Image
Jeff Mason
4 discussion posts
Thanks Thomas. Your code works perfectly!
Jun 5, 2018  • #6
Thomas Malloch (BFS)'s profile on WallpaperFusion.com
I liked your idea of combining the Macros into one function so much I made a version as well! I attached the code to this post if you, or anyone else is interested.

Thanks!
• Attachment: Incrementing PowerPaste.cfmacro [18,504 bytes]
Jun 12, 2018  • #7
User Image
Dmiitry
71 discussion posts
Great idea @Jeff Mason!
Thanks for elegant implementation, @Thomas Malloch - very useful.

To use "Incrementing PowerPaste" macro effectively, I need nicely arranged history: all items I intend to paste in desired order should follow strictly one after another in the history. Should we have a way to move items in history so that to re-order them? Sure, I can be disciplined and pay attention to how I copy things in the first place, but hey... we are not perfect.

Maybe allow users to re-arrange items in the History by drag-and-drop, or some other UI operation?
Jun 18, 2018  • #8
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(4)  Login to Vote(-)