The Execute JavaScript Action is available ONLY for Safari and Google Chrome.
These are actually two separate Actions, one for each browser.
This action allows you to execute a specified JavaScript, either from a file or text entered in the Action itself, and return the results.
If the results are to be saved to a variable or a clipboard then further text areas appear in the action allowing you to specify the variable or specific clipboard.
JavaScript can only GET Keyboard Maestro variables. They cannot be set:
var myData = document.kmvar.My_KM_Data
If your Keyboard Maestro Variable contains spaces, they must be replaced with underscores in the JavaScript.
So, for example:
Keyboard Maestro Variable Name: My KM Data JavaScript Reference: document.kmvar.My_KM_Data
If you need to set a Keyboard Maestro Variable from the Browser JavaScript, then use a JavaScript return to return the data to the Keyboard Maestro Action, which can be set to save the results as a Keyboard Maestro Variable.
If you need to set more than one Keyboard Maestro Variable, one approach is to return the data for each variable on a separate line (or with delimiters of your choice), and then parse in a following Keyboard Maestro Search Action using RegEx.
1. Return Data for Multiple Variables