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 | ||
JavaScript_for_Automation [2016/04/27 09:23] peternlewis [Which Execute JavaScript Should You Use?] |
JavaScript_for_Automation [2016/04/27 09:28] peternlewis [The Automation interface] |
||
---|---|---|---|
Line 28: | Line 28: | ||
{{:chromwinkeys.png?400|}}{{:undefined:jssafariactiondocument.png?400|}} | {{:chromwinkeys.png?400|}}{{:undefined:jssafariactiondocument.png?400|}} | ||
- | Keyboard Maestro’s [Execute a JavaScript in Safari](https://wiki.keyboardmaestro.com/action/Execute_a_JavaScript_in_Safari) and [Execute a JavaScript in Google Chrome](https://wiki.keyboardmaestro.com/action/Execute_a_JavaScript_in_Google_Chrome) actions are for interacting with web pages, whereas JXA is for automating OS X and OS X Applications. | + | Keyboard Maestro’s [Execute a JavaScript in Safari](https://wiki.keyboardmaestro.com/action/Execute_a_JavaScript_in_Safari) and [Execute a JavaScript in Google Chrome](https://wiki.keyboardmaestro.com/action/Execute_a_JavaScript_in_Google_Chrome) actions are for interacting with web pages, the [Execute a JavaScript in Custom Prompt](https://wiki.keyboardmaestro.com/action/Execute_a_JavaScript_in_Custom_Prompt) action is for interacting with Custom HTML Prompts, whereas JXA is for automating OS X and OS X Applications via the [Execute a JavaScript For Automation](https://wiki.keyboardmaestro.com/action/Execute_a_JavaScript_For_Automation) action. |
=====The basics – AppleScript and JavaScript for Automation side by side===== | =====The basics – AppleScript and JavaScript for Automation side by side===== | ||
Line 273: | Line 273: | ||
to follow ... | to follow ... | ||
+ | |||
+ | =====Accessing Keyboard Maestro Variables===== | ||
+ | |||
+ | You can access Keyboard Maestro variables from JXA scripts using the Keyboard Maestro Engine application. | ||
+ | |||
+ | var kme = Application("Keyboard Maestro Engine"); | ||
+ | kme.getvariable('Var'); | ||
+ | // kme.setvariable('Var', { to: "Hello There World!" }); | ||
=====The Automation interface===== | =====The Automation interface===== |