User Tools

Site Tools


action:Execute_a_JavaScript_in_Custom_Prompt

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
action:Execute_a_JavaScript_in_Custom_Prompt [2016/04/27 04:04]
peternlewis created
action:Execute_a_JavaScript_in_Custom_Prompt [2016/07/26 22:20]
JMichaelTX ADD Link to data-kmwindowid
Line 1: Line 1:
-The Execute JavaScript in Custom Prompt action allows you to execute a specified JavaScript, either from a file or text within a currently open Custom HTML Prompt. The JavaScript ​is executed ​in all [Custom HTML Prompt](https://​wiki.keyboardmaestro.com/​action/​Custom_HTML_Prompt) action with a matching ​windowid, or all if no windowid is specified. ​The JavaScript ​can return ​results. Options for the results of JavaScript ​results are:+{{:​action:​javascript-icon.png?​nolink|}} 
 +====== Execute JavaScript in Custom Prompt Action ====== 
 + 
 + 
 +The Execute JavaScript in Custom Prompt action ​(version 7.1+) allows you to execute a specified JavaScript ​in any active Keyboard Maestro [[action:​Custom_HTML_Prompt|Custom HTML Prompt]]. 
 + 
 +The **Execute ​JavaScript in Custom Prompt** action is the functional equivalent for the Custom HTML Prompt ​to these actions: 
 + 
 +* [Execute JavaScript in Safari](https://​wiki.keyboardmaestro.com/​action/​Execute_a_JavaScript_in_Google_Chrome) 
 +* [Execute JavaScript in Chrome](https://​wiki.keyboardmaestro.com/​action/​Execute_a_JavaScript_in_Google_Chrome) 
 + 
 + 
 +===== Source of Script ===== 
 + 
 + 
 +The JavaScript may be from any of the following:​ 
 + 
 +* From a JavaScript file  
 +* From the text script in the Action 
 +* Using any custom functions in the HTML Prompt. 
 + 
 +===== Target of Script ===== 
 + 
 +The JavaScript is executed in a specific [[action:​Custom_HTML_Prompt]] ​action with a matching ​[[action:​Custom_HTML_Prompt#​HTML_Window_Design|data-kmwindowid]], or all Custom HTML Prompts ​if no windowid is specified. ​ 
 + 
 + 
 + 
 + 
 +===== Results of Action ===== 
 + 
 +This Action ​can (optionally) ​return the results of the JavaScript:
  
   *ignore results.   *ignore results.
Line 12: Line 42:
  
 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. 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.
 +
 +===== Access to Keyboard Maestro Variables =====
  
 The JavaScript can access variables by using the window.KeyboardMaestro functions described in the [Custom HTML Prompt](https://​wiki.keyboardmaestro.com/​action/​Custom_HTML_Prompt) action. The JavaScript can access variables by using the window.KeyboardMaestro functions described in the [Custom HTML Prompt](https://​wiki.keyboardmaestro.com/​action/​Custom_HTML_Prompt) action.
  
 +===== Related Forum Topics =====
 +
 +* [Execute JavaScript in Custom Prompt Question ](https://​forum.keyboardmaestro.com/​t/​execute-javascript-in-custom-prompt-question/​4491)
action/Execute_a_JavaScript_in_Custom_Prompt.txt · Last modified: 2023/11/28 03:07 by peternlewis