I've seen various threads like this one -- how to trigger an existing macro via ID.
But I was wondering if it is possible to execute arbitrary XML on the KM engine via terminal/applescript.
IE There is an example here: that almost makes it seem like it's possible. IE:
tell application "Keyboard Maestro Engine"
do script "<dict><key>MacroActionType</key><string>SwitchToLastApplication</string></dict>"
end tell
But that doesn't seem to work for scripts I've written because error "Keyboard Maestro Engine got an error: do script found no macros with a matching name (macros must be enabled, and in macro groups that are enabled and currently active)." number -1
UPDATE:
Actually, this may not be a problem because I discovered that you can omit certain parts of the XML strategically and it seems to work.
For example
tell application "Keyboard Maestro Engine"
do script "<array>
<dict>
<key>Action</key>
<string>DisplayBriefly</string>
<key>MacroActionType</key>
<string>InsertText</string>
<key>Text</key>
<string>Hello WRLD</string>
</dict>
</array>"
end tell
This works, but it's only a small portion of the original XML export I used.