I am trying to use AppleScript to populate a dictionary with over 300 entries. The script looks something like this:
tell application "Keyboard Maestro Engine"
set m to make new dictionary with properties {name:"Users"}
tell m to make new dictionary key with properties {name:"0", value:"369SsqrmmP1"}
tell m to make new dictionary key with properties {name:"1", value:"qr39sNrL4g5"}
-- repeat like that ~360 times, with different `value`s until `name` is `360`
end tell
When I run the workflow it fails when trying to execute the script:
Execute an AppleScript failed with script error: text-script:30793:30867: execution error: Keyboard Maestro Engine got an error: Can’t get dictionary id "Users". (-1728). Macro “Log into my site” cancelled (while executing Execute AppleScript).
I also tried keeping the script in an external file but it fails in a similar way:
Execute an AppleScript failed with script error: /Users/erikhansen/Desktop/log-in.scpt:30449:30523: execution error: Keyboard Maestro Engine got an error: Can’t get dictionary id "Users". (-1728). Macro “Trying” cancelled (while executing Execute “log-in.scpt” AppleScript).
It seems like the issue is the AppleScript is too long or trying to put too many items into the dictionary; if only try to add 7 items to the dictionary, for example, it works fine.
Is there a limit on AppleScript sizes or execution times? Or a limit on the size of Keyboard Maestro dictionaries?
Thanks,
Erik