MACRO: Set Clipboard String for Type V1.0
Requires KM v11 or higher
It's possible someone already created a macro like this. I didn't spend a lot of time searching.
If there is another macro that does this, all I can say is this one has one Comment action, and a 4-line JXA script, so it's pretty clean.
PURPOSE:
Allows you to set the clipboard to a string, speficying the clipboard type.
Clipboard Types
Here's a couple of clipboard types to get you started:
Type | Result |
---|---|
public.html | HTML. With this format, you can paste the clipboard into RTF fields, including KM's Comment action, and get formatted text. |
public.rtf | If you have the plain text for some RTF, you can put it on the clipboard with this type. I think, anyway, I never tried it. (What do you want for free?) |
com.stairways.keyboardmaestro.macrosarray | You can put the XML for a KM Group on the clipboard with this text, and assuming you formatted the XML correctly, you can paste it into a new KM Macro. |
Examples:
This macro comes with two "example" macros:
- Set Clipboard String for Type Example - HTML/RTF
- Set Clipboard String for Type Example - Macro
See the comments inside them for more info.
Reusing the code
This macro is actually just one small JXA script, and it's really short. If you want to use it somewhere, just copy the action wherever you want.
The JXA script expects two variables to be set: "Local_Text" and "Local_Type".
If you create your own "Execute a Javascript" action, make sure you click the down-arrow next to the JXA code, and check "Modern Syntax".
VERSION HISTORY
1.0 - Initial Release
INSTALLATION
UPGRADE INSTRUCTIONS:
- Delete the old macros first.
Set Clipboard String for Type.v1.0.kmmacros.zip (4.0 KB)
Download the macro file, unzip it, and double-click the .kmmacros file. In addition to the two macros mentioned above, it will import this macro:
- Set Clipboard String for Type v1.0