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
Next revision
Previous revision
action:Execute_a_JavaScript_For_Automation [2023/09/13 02:56] peternlewisaction:Execute_a_JavaScript_For_Automation [2025/08/18 02:17] (current) – [Local & Instance Variables] peternlewis
Line 36: Line 36:
 You can turn Modern Syntax on or off in the popup menu next to the script. You can turn Modern Syntax on or off in the popup menu next to the script.
  
 +{{:action:modern-syntax.png?nolink|}}
 ===== Using Keyboard Maestro Variables ===== ===== Using Keyboard Maestro Variables =====
  
Line 93: 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 105: 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.1694573811.txt.gz · Last modified: by peternlewis

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki