How To Set Named Clipboard Using AppleScript

What is the proper AppleScript code to copy the rich text on the standard Clipboard to a KM Named Clipboard?

I’m trying to do a Search & Replace on styled text copied from an Evernote Note body. Due to some bug, KM can’t read the clipboard created from an EN @C, so I have to go through AppleScript.

I’ve worked out how to set a KM variable to the Clipboard using AppleScript, but I need the styled text.

I’ve searched Google and here, and have not found anything.

Any ideas?

Hmm. This works for me with Evernote 6.0.9 Beta 2.

Generic-Test 01
Triggered by any of the following:
The Hot Key F1 is pressed
Will execute the following actions:
Type the ⌘C Keystroke
Pause for 0.05 Seconds
Display Text in Window


Due to some bug, KM can’t read the clipboard created from an EN

Some applications only share their clipboard with the system when you take them to the background or to the front. So try switching to the Finder (for example) before using Evernote’s clipboard.

ccstone, thanks for the suggestion/code.
I tried it in EN Mac 6.0.7 and the result is “No Text in clipboard”.

So maybe EN has fixed the bug in Ver 6.0.9 B2. I have found EN betas to be too risky to use, so I’ll have to wait until the production release.


Thanks for the suggestion. Unfortunately it did not fix the issue.
No change in results.

Okay. Here's a teaser. :smile:

I was going to revert to 6.0.8 and test, but it won't let me - which indicates to me some major changes.


Hey Michael,

The new version is out:


It seems to be working well with the modality I posted earlier.


I’ve been able to resolve my underlying issue by updating to EN Mac 6.0.11.

However, it appears that it is NOT possible to create/set a KM Named Clipboard from Applescript.

Hey Michael,

If you look at the Keyboard Maestro Engine’s Suite in its AppleScript dictionary you won’t find a clipboard item, and that answers your question.


You can set a named clipboard from the clipboard from an AppleScript by triggering a macro from an AppleScript.

You can also feed the action XML to the do script AppleScript command, which would allow you to do this via AppleScript without creating a macro first, and/or with a varying named clipboard.