This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
AppleScript [2017/06/04 22:09] JMichaelTX [Get Existing Variable] |
AppleScript [2017/09/04 02:07] peternlewis |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Using AppleScript to Get and Set Keyboard Maestro Variables ====== | ====== Using AppleScript to Get and Set Keyboard Maestro Variables ====== | ||
- | \\ | + | |
===== Get and Set Variables ===== | ===== Get and Set Variables ===== | ||
Line 71: | Line 71: | ||
---- | ---- | ||
+ | |||
+ | ===== Get and Set Dictionary Values ===== | ||
+ | |||
+ | You can read and write dictionary values from AppleScript. | ||
+ | |||
+ | ```applescript | ||
+ | tell application "Keyboard Maestro Engine" | ||
+ | name of dictionaries | ||
+ | end tell | ||
+ | ``` | ||
+ | |||
+ | ```applescript | ||
+ | tell application "Keyboard Maestro Engine" | ||
+ | dictionary keys of dictionary "First Names" | ||
+ | end tell | ||
+ | ``` | ||
+ | |||
+ | ```applescript | ||
+ | tell application "Keyboard Maestro Engine" | ||
+ | set value of dictionary key "P" of dictionary "First Names" to "Fred" | ||
+ | end tell | ||
+ | ``` | ||
===== Prior to Ver 7.1 ===== | ===== Prior to Ver 7.1 ===== | ||
Line 86: | Line 108: | ||
| | ||
--- Compatible with Keyboard Maestro 6+ --- | --- Compatible with Keyboard Maestro 6+ --- | ||
- | -- • Creates the KM Variable it does not exist (just like KM 7 setvariable) | + | -- • Creates the KM Variable if does not exist (just like KM 7 setvariable) |
-- • Returns true if new Variable was created | -- • Returns true if new Variable was created | ||
| |