What is the best way to swap clipboards around?

I want to swap what is currently in my clipboard with what is previously set in my clipboard. And have them swap places. I know that KM keep track of all clipboards but I am not quite sure how to do the swap nicely.

1 Like

You can do this by setting the system clipboard to %PastClipboard%1% or whatever past clipboard entry you like, but can I ask why you would want to? Whatever your use case, it sounds like something that can be handled by KM’s clipboard history without the need to explicitly change the current clipboard to a past one (for example, you could have the macro paste %PastClipboard%1% instead of %SystemClipboard% at the appropriate point).

I have this macro for SnippetsLab :

upload github gist fully - [hover over snippet].kmmacros (29.9 KB)

That uploads a Snippet as a Gist and strips a prefix (i.e. bash:) and then copies both the title and the URL so I can include it in my wiki after.

Thing is that when I switch to Ulysses where I edit the wiki, I want to first enter the name of the gist and then enter the URL.

And yes I know I can use clipboard history, but I want to avoid that step as I will be doing this action very often. I want to always have name first, then URL. I will try to do the swap though and hope that works.

In that case, perhaps you’d be better off saving the title and URL to separate variables after copying them rather than relying on the clipboard history, and then paste them together in the order you like. Something like

Copy title
Set title_variable to System Clipboard
Copy URL
Set URL_variable to System Clipboard
Insert Text by pasting %Variable%title_variable%%Variable%URL_variable%

Alternately, if you copy the title and URL together, you could use the Search and Replace using Regular Expression action to separate them into variables that way.

1 Like

Set Clipboard to Past Clipboard action.

4 Likes