This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
action:Execute_an_AppleScript [2017/03/14 05:01] peternlewis |
action:Execute_an_AppleScript [2017/06/04 22:45] JMichaelTX [Using Keyboard Maestro Variables] minor clarification |
||
---|---|---|---|
Line 30: | Line 30: | ||
===== Using Keyboard Maestro Variables ===== | ===== Using Keyboard Maestro Variables ===== | ||
- | :!: **See [[manual:Scripting|Scripting]] for best methods.** | + | :!: **See [[:AppleScript|Using AppleScript to Get and Set Keyboard Maestro Variables]] for best methods.** |
+ | |||
+ | In AppleScript with Keyboard Maestro Version 7.1+, you can tell the application "Keyboard Maestro Engine" to: | ||
+ | |||
+ | getvariable <KM Variable Name> | ||
+ | setvariable <KM Variable Name> to <New Value> | ||
+ | |||
+ | where both the `<KM Variable Name>` and `<New Value>` are text values. | ||
+ | |||
+ | For example: | ||
+ | <code applescript> | ||
+ | tell application "Keyboard Maestro Engine" to set myVar to getvariable "My KM Variable" | ||
+ | </code> | ||
+ | --- | ||
**Using Keyboard Maestro Variables in a Shell Script from AppleScript** | **Using Keyboard Maestro Variables in a Shell Script from AppleScript** | ||
Line 39: | Line 52: | ||
set myVar to do shell script "echo $KMVAR_My_KM_Variable" | set myVar to do shell script "echo $KMVAR_My_KM_Variable" | ||
</code> | </code> | ||
- | However, if setting an AppleScript Variable to a Keyboard Maestro Variable is all you needed to do, then you would use this (requires Ver 7.1+): | + | |
- | <code applescript> | + | |
- | tell application "Keyboard Maestro Engine" to set myVar to getvariable "My KM Variable" | + | |
- | </code> | + |