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 | ||
manual:Dictionaries [2017/10/05 23:02] peternlewis [Dictionaries] |
manual:Dictionaries [2021/05/31 03:33] ccstone [AppleScript] |
||
---|---|---|---|
Line 13: | Line 13: | ||
For example, you might have a dictionary named "Shop Prices", with keys being the item names and values being the cost of the item. | For example, you might have a dictionary named "Shop Prices", with keys being the item names and values being the cost of the item. | ||
- | ^Dictionary^Name^Value^ | + | ^Dictionary^Key^Value^ |
| Shop Prices \\ Shop Prices \\ Shop Prices| Coffee \\ Cake \\ Drink| 3.45 \\ 5.35 \\ 2.50| | | Shop Prices \\ Shop Prices \\ Shop Prices| Coffee \\ Cake \\ Drink| 3.45 \\ 5.35 \\ 2.50| | ||
Line 34: | Line 34: | ||
```applescript | ```applescript | ||
tell application "Keyboard Maestro Engine" | tell application "Keyboard Maestro Engine" | ||
- | name of dictionaries | + | set dictionaryNameList to name of dictionaries |
end tell | end tell | ||
``` | ``` | ||
Line 40: | Line 40: | ||
```applescript | ```applescript | ||
tell application "Keyboard Maestro Engine" | tell application "Keyboard Maestro Engine" | ||
- | dictionary keys of dictionary "First Names" | + | |
+ | set newDict to make new dictionary with properties {name:"Shop Prices"} | ||
+ | |||
+ | # If you don't set a key/value pair the newly created dictionary above goes up in smoke. | ||
+ | tell newDict | ||
+ | make new dictionary key with properties {name:"Coffee", value:"3.50"} | ||
+ | end tell | ||
+ | |||
+ | end tell | ||
+ | ``` | ||
+ | |||
+ | ```applescript | ||
+ | tell application "Keyboard Maestro Engine" | ||
+ | set dictKeyList to dictionary keys of dictionary "Shop Prices" | ||
end tell | end tell | ||
``` | ``` | ||
Line 46: | Line 59: | ||
```applescript | ```applescript | ||
tell application "Keyboard Maestro Engine" | tell application "Keyboard Maestro Engine" | ||
- | set value of dictionary key "P" of dictionary "First Names" to "Fred" | + | set value of dictionary key "Coffee" of dictionary "Shop Prices" to "4.50" |
end tell | end tell | ||
``` | ``` |