I copied the entire XML tree, omitting the descriptive portion in the head and tail of the body.
However, the script below throws the error in the title. Why?
set x to 964
set y to 419
tell application "Keyboard Maestro Engine" to do script "<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>CustomIconData</key>
<string>KMEP-ToolbarCustomize</string>
<key>IsActive</key>
<true/>
<key>Macros</key>
<array>
<dict>
<key>Actions</key>
<array>
<dict>
<key>Action</key>
<string>Click</string>
<key>Button</key>
<integer>0</integer>
<key>ClickCount</key>
<integer>1</integer>
<key>DisplayMatches</key>
<false/>
<key>DragHorizontalPosition</key>
<string>0</string>
<key>DragVerticalPosition</key>
<string>0</string>
<key>Fuzz</key>
<integer>15</integer>
<key>HorizontalPositionExpression</key>
<string>" & x & "</string>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>MouseMoveAndClick</string>
<key>Modifiers</key>
<integer>0</integer>
<key>MouseDrag</key>
<string>None</string>
<key>Relative</key>
<string>Window</string>
<key>RelativeCorner</key>
<string>BottomLeft</string>
<key>RestoreMouseLocation</key>
<true/>
<key>VerticalPositionExpression</key>
<string>" & y & "</string>
</dict>
</array>
<key>IsActive</key>
<true/>
<key>ModificationDate</key>
<real>776103894.95478904</real>
<key>Name</key>
<string>Click Template</string>
<key>Triggers</key>
<array/>
<key>UID</key>
<string>1434BD9A-DF0D-472F-AB74-D0F1390D1A07</string>
</dict>
</array>
<key>Name</key>
<string>Test and Debug</string>
<key>UID</key>
<string>0056D82C-1CAD-4CF8-81AC-188206398729</string>
</dict>
</array>"
Nige_S
August 6, 2025, 11:44am
2
You've included the Macro Group info in there as well (top and bottom) -- try
set x to 964
set y to 419
tell application "Keyboard Maestro Engine" to do script "<array>
<dict>
<key>Actions</key>
<array>
<dict>
<key>Action</key>
<string>Click</string>
<key>Button</key>
<integer>0</integer>
<key>ClickCount</key>
<integer>1</integer>
<key>DisplayMatches</key>
<false/>
<key>DragHorizontalPosition</key>
<string>0</string>
<key>DragVerticalPosition</key>
<string>0</string>
<key>Fuzz</key>
<integer>15</integer>
<key>HorizontalPositionExpression</key>
<string>" & x & "</string>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>MouseMoveAndClick</string>
<key>Modifiers</key>
<integer>0</integer>
<key>MouseDrag</key>
<string>None</string>
<key>Relative</key>
<string>Window</string>
<key>RelativeCorner</key>
<string>BottomLeft</string>
<key>RestoreMouseLocation</key>
<true/>
<key>VerticalPositionExpression</key>
<string>" & y & "</string>
</dict>
</array>
<key>IsActive</key>
<true/>
<key>ModificationDate</key>
<real>776103894.95478904</real>
<key>Name</key>
<string>Click Template</string>
<key>Triggers</key>
<array/>
<key>UID</key>
<string>1434BD9A-DF0D-472F-AB74-D0F1390D1A07</string>
</dict>
</array>"
It made no difference. Is this a bug, I wonder ? This is version 6. However, the "do script" entry of the app's AppleScript Dictionary for KM explicitly mentions the plist as an arg.
Nige_S
August 6, 2025, 2:19pm
4
scrutinizer:
It made no difference.
Keep trimming entries off the top and bottom until you get to just an array of actions:
set x to 964
set y to 419
tell application "Keyboard Maestro Engine" to do script "<array>
<dict>
<key>Action</key>
<string>Click</string>
<key>Button</key>
<integer>0</integer>
<key>ClickCount</key>
<integer>1</integer>
<key>DisplayMatches</key>
<false/>
<key>DragHorizontalPosition</key>
<string>0</string>
<key>DragVerticalPosition</key>
<string>0</string>
<key>Fuzz</key>
<integer>15</integer>
<key>HorizontalPositionExpression</key>
<string>" & x & "</string>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>MouseMoveAndClick</string>
<key>Modifiers</key>
<integer>0</integer>
<key>MouseDrag</key>
<string>None</string>
<key>Relative</key>
<string>Window</string>
<key>RelativeCorner</key>
<string>BottomLeft</string>
<key>RestoreMouseLocation</key>
<true/>
<key>VerticalPositionExpression</key>
<string>" & y & "</string>
</dict>
</array>
"
Sorry -- but I'm not awake enough to test-run random XML
If the script starts with <dict> then it must be an action . This is not an action.
If the script starts with <array> then it must be an array of actions . This is not an array of actions.
So if you want to execute a sequence of actions by using do script, the second array shown in your script is the one you want. The one that is an array of action dictionaries.
Perhaps something got lost in the posting there ?
I wonder if the two gaps, created by Discourse processing of XML (or HTML) tags,
were meant to be filled with:
<dict>
and
<array>
?
Yeah, fixed. I guess it decided they were meant to be HTML tags?
1 Like