Create new variable or named clipboard within macro?

Diving into KM after the release of version 7, I haven’t been able to find a way to create a new variable or named clipboard (which are pretty much interchangeable really, aren’t they?) programmatically within a macro. What I’d like is a macro that permanently stores arbitrary snippets as I run across them, without having to anticipate in advance what they might be. Think of the Scrapbook in the pre-OS X Mac OS. Any suggestions?

At the simplest level, you can add a new name:value pair on the fly with some elaboration of this kind of kernel:

Set value of new variable.kmmacros (2.9 KB)

1 Like

I’m not sure of the type of “snippets” you want to capture, or how you want to use them, but you might consider tools other than KM for the job. I love KM and use it many times a day. But I also make good use of the below, which may be a better tool for certain uses:

  • Evernote – great for all kinds of snippets, except code, has the best web clipper of any tool
  • TextExpander – great text expander for text and images
  • Typinator – great text expander for text and images

Variables and Named Clipboards are not interchangeable.

They are quite different. Named Clipboards allow any kind of styled information. Variables are plain text, which can represent a number, and can be used in numeric fields, as well as text fields.

Generally, creating them on the fly would be an unusual way of operating since they would not be grouped together in any sensible way. Better would be to use some sort of semi-structured file to store your clippings, perhaps something along the lines of the Save a Text Clipping action in the Macro Examples in the documentation.


I think I can get most of what I want by using the Named Clipboard Switcher. However I’m getting some unexpected behavior once it’s open — which I guess makes this a bug report.

First, it doesn’t visually update when clicking the Add or Delete buttons; the changes are only visible after dismissing the switcher and invoking it again.
Second, activating any button after tabbing to it with the keyboard (with full keyboard access enabled in the system Keyboard preference pane) actuates the Quick Look function, regardless of which button is visually active.

While I’m at it, I might as well add a feature request: sorting options by title, content, and date.


I don’t see this behaviour - the display is updated for Add/Delete/Copy into/etc.

How are you triggering the button? Space does Quick Look. In my tests, Return and Enter did not activate the button, in fact I couldn’t get the buttons to activate with any keystroke.


Oh — I guess I’m just triggering Quick Look with the space bar and not actually using the buttons at all. Can I get to the buttons from the keyboard?
And do you have any suggestions for how to troubleshoot the failure to update? (I’m on KM 7.0, OSX 10.10.4 btw.)


You can use command keys: X,C,V,N,Delete

@ccstone: This also explains why you can’t paste into the search field.

Excellent, that gets me 90% of the way to where I want to be. Now, any thoughts on what might be causing the failure to refresh, or how to go about trying to identify it?

Not really, no. Perhaps some sort of conflict with something? Try on another user to see if it is system-wide or user-specific.