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 | ||
Scripting_the_Keyboard_Maestro_editor [2017/09/20 16:41] JMichaelTX [1. Get Current Macro Object] Revise script |
Scripting_the_Keyboard_Maestro_editor [2017/09/20 23:24] JMichaelTX ADD selecting lists of objects |
||
---|---|---|---|
Line 4: | Line 4: | ||
The Keyboard Maestro Scripting Definition (sdef) describes all the support, and you can open in in the Script Editor to see more details. Here are some examples of what you can do: | The Keyboard Maestro Scripting Definition (sdef) describes all the support, and you can open in in the Script Editor to see more details. Here are some examples of what you can do: | ||
+ | |||
+ | FIXME Just adding this until I can provide a more complete script. | ||
+ | |||
+ | ===== Selecting Lists of Objects in KM8 ===== | ||
+ | |||
+ | ```applescript | ||
+ | tell application "Keyboard Maestro" | ||
+ | set selList to selection | ||
+ | set macroList to selected macros | ||
+ | set grpList to selected macro groups | ||
+ | end tell | ||
+ | ``` | ||
+ | |||
===== 1. Get Current Macro Object ===== | ===== 1. Get Current Macro Object ===== | ||
Line 17: | Line 30: | ||
| | ||
if ((count of macroList) = 1) then | if ((count of macroList) = 1) then | ||
- | set oMacro to first macro whose selected is true | + | set oMacro to item 1 of macroList |
else | else | ||
error "Multiple Macros are selected. Select only ONE and re-execute this script." | error "Multiple Macros are selected. Select only ONE and re-execute this script." |