Keyboard Maestro Dictionary Feature Requests

Hey @peternlewis,

I've tried every which way to create a Keyboard Maestro dictionary with AppleScript and had no success.

For instance:

tell application "Keyboard Maestro Engine"
   set newDict to make new dictionary with properties {name:"TestDict01"}
   # The above line _does_ return a correct looking result, but it doesn't work.
   set value of dictionary key "Coffee" of dictionary "Testdict01" to "3.50" --> Error
end tell

tell application "Keyboard Maestro Engine"
   set newDict to make new dictionary with properties {name:"TestDict01"}
   # The above line _does_ return a correct looking result, but it doesn't work.
   set value of dictionary key "Coffee" of newDict to "3.50" --> Error
end tell

Unfortunately both of these fail.

I do note it is possible to delete dictionaries with AppleScript, so the above comes as an extra surprise.

Please demonstrate the correct syntax if there is one.

If AppleScripted dictionary creation is not possible then please consider this a feature request.

It would make working with dictionaries MUCH easier.

I've worked around this for the time being by using a do script'ed XML action in my test AppleScript, but that is a very inelegant solution that few users would think of.

-Chris

2 Likes

This seems to work:

tell application "Keyboard Maestro Engine"
   
   set newDict to make new dictionary with properties {name:"TestDict03"}
   
   tell newDict
      make new dictionary key with properties {name:"Coffee", value:"3.50"}
   end tell
   
end tell
2 Likes

Aha! It does.

Thanks!

I'll update the Wiki.

-Chris

1 Like