User Tools

Site Tools


AppleScript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
AppleScript [2025/02/27 06:40] – [Using AppleScript to Get and Set Keyboard Maestro Variables] peternlewisAppleScript [2025/02/27 06:45] (current) – [Local & Instance Variables] peternlewis
Line 80: Line 80:
  
  
-To get or set [[manual:Variables#Instance_Variables_v8|Local or Instance Variables]], you must pass the macro execution instance to the `getvariable` or `setvariable` command.  The instance is passed in to your script via the KMINSTANCE environment variable (v8.0.3+)+To get or set [[manual:Variables#Scope|Local or Instance Variables]], you must pass the macro execution instance to the `getvariable` or `setvariable` command.  The instance is passed in to your script via the KMINSTANCE environment variable (v8.0.3+).
- +
-  * //Local Variables// are denoted by a Variable with the prefix of "Local"+
-  * //Instance Variables// are denoted by a Variable with the prefix of "Instance".+
  
 ```applescript ```applescript
-### Requires Keyboard Maestro 8.0.3+ ### 
- 
 set kmInst to system attribute "KMINSTANCE" set kmInst to system attribute "KMINSTANCE"
 tell application "Keyboard Maestro Engine" tell application "Keyboard Maestro Engine"
- set kmLocalVar1 to getvariable "Local__SomeLocalVariable" instance kmInst+ set to getvariable "Local__SomeLocalVariable" instance kmInst
  setvariable "Local__FromAS" instance kmInst to "Variable set in AppleScript."  setvariable "Local__FromAS" instance kmInst to "Variable set in AppleScript."
 end tell end tell
  
-log kmLocalVar1+log v
 ``` ```
  
AppleScript.1740638449.txt.gz · Last modified: by peternlewis

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki