I've been expanding my AppleScript activities and have run into a problem that I hope can be solved.
In the following example AppleScript taken from a test KM macro
tell application "Keyboard Maestro Engine"
set v1 to process tokens "%SafariTitle%"
set v2 to process tokens "%ExecutingMacro%"
end tell
display dialog v1 with title "Testing SafariTitle"
display dialog v2 with title "Testing ExecutingMacro"
The first dialog shows the title of the current page in Safari fine but the second dialog displays nothing for v2
. In other words, the KM text token %ExecutingMacro%
is not being picked up.
This has been mentioned in a previous post from 2016 (AppleScript process tokens with some Macro Information tokens) as being a consequence of how AppleScripts work in KM.
As I'm developing a plugin action, I need the plugin's AppleScript code to obtain the value of %ExecutingMacro%
, but I do not want to have to put that value in a KM variable first as stated in the above 2016 discussion. The reason is that having to use a KM variable would be external and additional to the plugin and would require the named variable and the code in the plugin to be coordinated and therefore subject to error.
My request to @peternlewis is this: can text tokens such as %ExecutingMacro%
be made to play nice with AppleScript in KM in a future update? Or is there some other AppleScript magic that can be used to obtain such text tokens' values?