Clipboard Stack Macros

Clipboard Stack Macros

The clipboard stack in this group is actually limited to 12 items rather than 15, as I had originally stated in the "What are your top used macros that you’ve made?" post in the General category of the forum (apologies).


Before attempting to use the macros in this group, use the Clipboards module of preferences in Keyboard Maestro to ensure that each of the new Clipboard Stack items contains only "STACKEMPTY". The easiest way to do that is to

  1. use Clipboards in KM preferences to change the contents of the new STACKEMPTY clipboard item to "STACKEMPTY" (no quotes, of course), then to

  2. press ⌃⌘F9 to clear the rest of the Clipboard Stack.

Each time the Clipboard Stack is used, the content of the system clipboard is replaced, so it's probably a good idea to become familiar with the "Preserve clipboard" and "Restore clipboard from backup" macros before using the macros that modify the stack. In more recent versions of Keyboard Maestro, it may be possible to implement the ClipBoard Stack solution without affecting the system clipboard, so if you have a suggestion about how to do that, please let me know. Thanks.

Clipstack Add adds to the stack the current selection (anything suitable for placing on the clipboard) as well as making it the newest clip stack item.
Clipstack Pop pastes the newest clip stack item (clip stack 1) and places it on the system clipboard, then removes it from the stack.
Clipstack Pull pastes the oldest clip stack item and places it on the system clipboard, then removes it from the stack.

The other macros should be self-explanatory, mostly.

A sample use of the Clipboard Stack would be to reverse the order of a list of items in a context where it would be impractical to apply other sorting automation, such as when completing some web forms. Once the macro group is loaded on your system, you can test the functionality using the following list.


For example, select the top number (01) by double-clicking, press ⌥F9, then do the same with the remaining 11 numbers. You can then repeatedly press ⌥F11 followed by return in most any text entry field to quickly generate a reverse version of the list.

Untitled Macro File.kmmacros (78 KB)

Here's a brief video illustrating the use of the Clipboard Stack.


Interesting stuff. The application of it kind of eludes me, but I can only figure you copy and paste a lot more than I do!

Out of curiosity, have you tried doing this by manipulating clipboard history rather than making a ton of named clipboards?

No, when I first created it, I think clipboard history had just been implemented for KB, or maybe it wasn’t yet implemented. Ultimately, it would be better for this to bypass the system clipboard entirely, I think, but I’m not sure if there’s a way to do that.

Any chance you could make a short screencast of how you use this? Just something simple, like if I was looking over your shoulder and saw you use it, and I’d go - “Hey! How’d you do that?”

I’d have to give that some thought. I haven’t seen too many video tutorials made available from the forum, is there a collection of them somewhere? I don’t think there would be much advantage unless the trigger execution was captured along with the results, and I haven’t been able to get Keycastr or the demo version of Mouseposé to work very well in recent versions of the system. I could try changing the triggers so they could be displayed in the Keyboard Viewer or use a macro palette or set up an external video camera to capture the triggers, but I’m not sure how effective those options would really be.

So @Lantro, after messing around with your macros a bit, I found myself copying and pasting a bunch of email addresses from a document into a meeting invitation. (Yes, I have the funnest job ever!) Unfortunately I was about 2/3 of the way through before I remembered your macros, but I gave it a try and it really clicked for me.

I think the whole cycling and pulling and pushing and popping is overkill for me, though, so I went ahead and made a much simpler macro that just pastes in the current system clipboard, and then deletes it from the clipboard history, rolling back to the previous clipboard contents.

This works very nicely for pasting in a series of items one after another. Also handy if you're copying and pasting a password and don't want to keep it in clipboard history.

1 Like

Preface: I don’t think I need the screencast any more. I think I’ve got it now. But I’ll answer your questions anyway, because you never know when you might want to do a screencast in the future.

First off, you wouldn’t host them here - use YouTube.

Second, search YouTube and you’ll find some KM tutorials. But don’t be intimidated by them - everyone starts somewhere.

I use ScreenFlow, and I think it’s one of the best. It captures keyclicks and mouse actions, and after recording you can decide if/when and where to show these clicks and mouse actions. Here’s an example from one if my tutorials:

Great! Thanks.

Certainly ScreenFlow is one of the best, but it’s pricey, unless you’re using it for work. I have Voila (which was just replaced by Capto) and it has some of the same functionality, although t’s not quite as elaborate, I think. Thanks for your video link!

I had forgotten how much it cost. And while $100 isn’t huge, it’s certainly more than I remembered it. To me it’s still worth it, even if it isn’t for work, but I totally get your point.

Yes, I think I would have to display keystrokes post-production with Voila. But I may go ahead and do a brief screencast just to demonstrate a possible practical use of a clip stack. Thanks again.

OK, well here’s a video demonstration.

Cool! Normally I don’t like music in the background, but in this case, it works for me. It was kind of cool.

And of course I have to say the obvious, because it’s a rule when you comment on someone else’s tutorials: “You know there’s an easier way to do what you were doing, right?” :stuck_out_tongue:

That’s one of my frustrations with demoing anything. You look for an example that makes sense, and people always focus on the specific task, rather than the fact you’re showing a technique that could be useful in other situations. I know when I finally do some of the tutorials for how I use KM in Final Cut, some people will focus on my workflow, and not on how much easier KM makes it.

I have no idea why I just went off here. Sometimes I wander around in my mind… LOL.

Anyway, thanks for the tutorial! Makes sense now!