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 | ||
action:Custom_HTML_Prompt [2017/09/07 05:25] peternlewis [How To Use] |
action:Custom_HTML_Prompt [2017/10/04 02:54] peternlewis [Using JavaScript] |
||
---|---|---|---|
Line 99: | Line 99: | ||
|*data-kmignoresubmit* |avoid saving form field back to the *Keyboard Maestro Variable*| | |*data-kmignoresubmit* |avoid saving form field back to the *Keyboard Maestro Variable*| | ||
|*data-kmignore* | avoid setting and saving the form field| | |*data-kmignore* | avoid setting and saving the form field| | ||
+ | |||
+ | ==== Handling HTTP links ==== | ||
+ | |||
+ | By default, http: and other links (everything except file: links) are passed to the to open as normal. | ||
+ | |||
+ | You can elect (v8+) to handle schemes yourself by including a `data-kmhandleschemes` attribute in the body element, or by implementing the `KMHandleSchemes()` function. | ||
+ | |||
+ | Either can return the schemes you want to handle (most likely only http) as a comma or space separated list. | ||
===== Using JavaScript ===== | ===== Using JavaScript ===== | ||
Line 104: | Line 112: | ||
You may use any JavaScript that you normally could in an HTML page. | You may use any JavaScript that you normally could in an HTML page. | ||
- | Keyboard Maestro provides the following built-in JavaScript functions: | + | Keyboard Maestro calls the following JavaScript functions: |
^ Function ^ Called ^ | ^ Function ^ Called ^ | ||
Line 110: | Line 118: | ||
| KMWindow() | to return the desired size or frame of the window as a string| | | KMWindow() | to return the desired size or frame of the window as a string| | ||
| KMWillShowWindow() | when the window will be shown| | | KMWillShowWindow() | when the window will be shown| | ||
- | | KMDidShowWindow() | when the window was just shown (7.1+) | | + | | KMDidShowWindow() | when the window was just shown (v7.1+) | |
+ | | KMHandleSchemes() | to return the schemes you wish to handle within the web page (v8+) | | ||
+ | | KMWillCloseWindow() | called when the window is about to be closed (v8.0.3+) | | ||
From within the window, you can call the following functions: | From within the window, you can call the following functions: | ||
Line 120: | Line 130: | ||
| window.KeyboardMaestro.GetVariable( 'KMVariableName' ) | returns the value of a variable | | | window.KeyboardMaestro.GetVariable( 'KMVariableName' ) | returns the value of a variable | | ||
| window.KeyboardMaestro.SetVariable( 'KMVariableName', 'value' ) | sets the value of a variable | | | window.KeyboardMaestro.SetVariable( 'KMVariableName', 'value' ) | sets the value of a variable | | ||
+ | | window.KeyboardMaestro.GetDictionary( 'Dictionary', 'Key' ) | returns the value of a dictionary entry | | ||
+ | | window.KeyboardMaestro.SetDictionary( 'Dictionary', 'Key', 'value' ) | sets the value of a dictionary entry | | ||
| window.KeyboardMaestro.ProcessTokens( '%ShortDate%' ) | returns the text token expansion | | | window.KeyboardMaestro.ProcessTokens( '%ShortDate%' ) | returns the text token expansion | | ||
| window.KeyboardMaestro.Calculate( '10 + 32' ) | returns the result of the calculation | | | window.KeyboardMaestro.Calculate( '10 + 32' ) | returns the result of the calculation | | ||
Line 125: | Line 137: | ||
Prior to version 7.1, using SetVariable to set a value to something other than a string can [corrupt the variable](https://forum.keyboardmaestro.com/t/corrupted-variables-after-custom-html-setvariable-update-i-fixed-it-please-read/2881). | Prior to version 7.1, using SetVariable to set a value to something other than a string can [corrupt the variable](https://forum.keyboardmaestro.com/t/corrupted-variables-after-custom-html-setvariable-update-i-fixed-it-please-read/2881). | ||
- | |||
==== Form Validation ==== | ==== Form Validation ==== | ||