Hey Folks,
Courtesy of Shane Stanley.
I'll get back again as soon as I find out how to put the KM-Action and KM-Macro data-types back on the Clipboard.
-Chris
---------------------------------------------------------------------------------
# Auth: Christopher Stone { Heavy Lifting by Shane Stanley }
# dCre: 2016/06/03 22:05
# dMod: 2016/06/03 22:33
# Appl: Keyboard Maestro
# Task: Extract Keyboard Maestro action or macro plist from the clipboard.
# Aojc: True
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Extract, @Keyboard_Maestro, @Plist
---------------------------------------------------------------------------------
use framework "Foundation"
use scripting additions
---------------------------------------------------------------------------------
set kmPlistStr to missing value
set systemPasteBoard to current application's NSPasteboard's generalPasteboard()
if (systemPasteBoard's canReadItemWithDataConformingToTypes:{"com.stairways.keyboardmaestro.actionarray"}) as boolean then
# Copied Action or Actions
set kmPlistStr to systemPasteBoard's stringForType:"com.stairways.keyboardmaestro.actionarray"
else if (systemPasteBoard's canReadItemWithDataConformingToTypes:{"com.stairways.keyboardmaestro.macrosarray"}) as boolean then
# Copied Macro or Macros
set kmPlistStr to systemPasteBoard's stringForType:"com.stairways.keyboardmaestro.macrosarray"
end if
if kmPlistStr ≠ missing value then
return kmPlistStr as text
else
beep
end if
---------------------------------------------------------------------------------