Can I get the result of macro in applescript?

Hey @xream,


The Keyboard Maestro Engine’s do script command only causes the given macro to run and does not collect a return value.

The macro itself would have to output to the Clipboard or to a variable that AppleScript can see.

Using your macro above as an example – you can do something like this:

tell application "Keyboard Maestro Engine"
   do script "Generic-Test 01"
   set clipboardContent to getvariable "clip0"
end tell

Or you can be more direct:

tell application "Keyboard Maestro Engine"
   set clipboardContent to process tokens "%PastClipboard%1%"
end tell


Thank you very much.

1 Like