Hey Folks,
Again courtesy of Shane Stanley.
This script will put a Keyboard Maestro Action on the Clipboard ready for pasting into a macro.
The same script with the alternate data-type can be used to put a Keyboard Maestro Macro on the Clipboard ready for pasting.
-Chris
---------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/06/03 22:45
# dMod: 2016/06/03 22:56
# Appl: Keyboard Maestro
# Task: Put Action or Macro Plist data on the clipboard with appropriate data-type.
# Aojc: True
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Keyboard_Maestro, @Plist, @ASObjC
---------------------------------------------------------------------------------
use framework "Foundation"
use scripting additions
---------------------------------------------------------------------------------
# Action data-type
set kmPasteboardDataType to "com.stairways.keyboardmaestro.actionarray"
# Macro data-type
# set kmPasteboardDataType to "com.stairways.keyboardmaestro.macrosarray"
set kmPlistData to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<array>
<dict>
<key>MacroActionType</key>
<string>Notification</string>
<key>SoundName</key>
<string>Tink</string>
<key>Subtitle</key>
<string>EUREKA! IT WORKS!</string>
<key>Text</key>
<string></string>
<key>Title</key>
<string>%ExecutingMacro%</string>
</dict>
</array>
</plist>
"
set systemPasteBoard to current application's NSPasteboard's generalPasteboard()
systemPasteBoard's clearContents()
systemPasteBoard's setString:kmPlistData forType:kmPasteboardDataType
---------------------------------------------------------------------------------