User Tools

Site Tools


action:Execute_a_JavaScript_For_Automation

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
action:Execute_a_JavaScript_For_Automation [2025/08/18 02:12] – [Modern Syntax] peternlewisaction:Execute_a_JavaScript_For_Automation [2025/08/18 02:17] (current) – [Local & Instance Variables] peternlewis
Line 94: Line 94:
 ==== Local & Instance Variables ==== ==== Local & Instance Variables ====
  
-Keyboard Maestro has [[manual:Variables#Instance_Variables_v8|Local and Instance Variables]].  In order to get or set these, you need to use different parameters in the JXA get/set methods.  Here is an example.+Keyboard Maestro has [[manual:Variables#Instance_Variables_v8|Local and Instance Variables]].  In order to get or set these, you need to have the instance information of the macro and use different parameters in the JXA get/set methods.  
  
 ```javascript ```javascript
Line 106: Line 106:
 kmeApp.setvariable("Local__FromJXA", {instance: kmInst, to: "Set in JXA Script"}) kmeApp.setvariable("Local__FromJXA", {instance: kmInst, to: "Set in JXA Script"})
 ``` ```
 +
 +Note that this method is only useful if you are not using Modern Syntax (since you can access the local variables directly through the `kmvar` hash), and you need the instance information by some means (passed as an environment variable in the case of the `Execute a JavaScript For Automation` action, but in other cases external to the Keyboard Maestro Engine you would need some other method of getting it).
 +
  
 ===== Displaying User Dialogs ===== ===== Displaying User Dialogs =====
action/Execute_a_JavaScript_For_Automation.txt · Last modified: by peternlewis

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki