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

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
action:Execute_a_JavaScript_in_Custom_Prompt [2016/07/26 20:16]
JMichaelTX
action:Execute_a_JavaScript_in_Custom_Prompt [2016/07/30 14:30]
JMichaelTX ADD Example with screenshot
Line 1: Line 1:
 {{:​action:​javascript-icon.png?​nolink|}} {{:​action:​javascript-icon.png?​nolink|}}
-====== Execute JavaScript in Custom Prompt Action ======+====== Execute JavaScript in Custom ​HTML Prompt Action ======
  
  
Line 10: Line 10:
 * [Execute JavaScript in Chrome](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)
  
 +===== Example =====
 +
 +{{:​action:​km-7.2-execute-script-in-html-prompt-example.png?​nolink|}}
 +
 +Note the purpose of this example is to close an existing HTML Prompt window, and it calls a custom JavaScript function already in the Custom HTML Prompt. ​ The Action option of "​asynchronously"​ is chosen to avoid timeout of the Action. ​ Otherwise, the Action will wait for a response from the HTML Prompt, which will never come.
  
 ===== Source of Script ===== ===== Source of Script =====
Line 22: Line 27:
 ===== Target of Script ===== ===== Target of Script =====
  
-The JavaScript is executed in a specific [Custom HTML Prompt](https://​wiki.keyboardmaestro.com/​action/Custom_HTML_Promptaction with a matching ​windowid, or all Custom HTML Prompts if no windowid is specified. ​+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. ​ 
 + 
  
  
Line 29: Line 36:
 This Action can (optionally) return the results of the JavaScript: This Action can (optionally) return the results of the JavaScript:
  
-  *ignore results. +  * ignore results 
-  *display results in a window. +  * display results in a window 
-  *display results briefly. +  * display results briefly 
-  *display results large. +  * display results large 
-  *type results. +  * type results 
-  *paste results. +  * paste results 
-  *save results to variable. +  * save results to variable 
-  *save results to the system clipboard or a named clipboard. +  * save results to clipboard 
-  *save results ​asynchronously ​ ​— ​the action runs while the macro continues on.+    * Either ​the system clipboard or a named clipboard 
 +  * asynchronously 
 +    * Results are **not** saved 
 +    * The macro immediately continues to the next action, which runs in parallel with the current action
  
 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.
action/Execute_a_JavaScript_in_Custom_Prompt.txt · Last modified: 2023/11/28 03:07 by peternlewis