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 | ||
manual:Scripting [2017/09/08 04:26] peternlewis |
manual:Scripting [2018/07/02 19:38] JMichaelTX Add setup options table |
||
---|---|---|---|
Line 18: | Line 18: | ||
For example, the [[action:Execute_an_AppleScript]] Action:\\ | For example, the [[action:Execute_an_AppleScript]] Action:\\ | ||
{{:km-7.3-execute-script.png?nolink|}}\\ | {{:km-7.3-execute-script.png?nolink|}}\\ | ||
+ | |||
+ | **There are two setup options:** | ||
+ | ^ Setup Option ^ Choices\\ (Default shown first) ^ | ||
+ | | Script location | Execute text script (type or paste script into Action text field)\\ Execute script file (This is faster if it is a compiled script file `.scpt`) | | ||
+ | | Script Results | Ignored.\\ Displayed in a floating window.\\ Displayed briefly in a Notification.\\ Typed in the current text field that has focus.\\ Pasted in text field that has focus.\\ Saved to a Keyboard Maestro Variable.\\ Saved to the System or Named Clipboard.\\ Ignore Results and run //Asynchronously// (the script runs while the macro continues on to the next //Action//.) | | ||
+ | |||
==== Getting Script Results ==== | ==== Getting Script Results ==== | ||
Line 165: | Line 171: | ||
</code> | </code> | ||
- | You can ask Keyboard Maestro Engine to process tokens for you with: | + | You can ask Keyboard Maestro Engine to find strings in other scripts: |
+ | |||
+ | <code applescript> | ||
+ | tell application "Keyboard Maestro Engine" | ||
+ | count found in "The Source" for ".e" with regex | ||
+ | end tell | ||
+ | </code> | ||
+ | |||
+ | And you can search and replace with: | ||
<code applescript> | <code applescript> | ||
tell application "Keyboard Maestro Engine" | tell application "Keyboard Maestro Engine" | ||
- | set clip to process tokens "%PastClipboard%3%" | + | search "3+4" for "(\\d+)" replace "%CalculateFormat%CALCULATE(\\1)%Currency%" with regex and process tokens |
end tell | end tell | ||
</code> | </code> | ||
Line 185: | Line 199: | ||
</code> | </code> | ||
- | Alternatively you can use the [[/action/Set_Macro_Enable|Set Macro Enable action]]. | + | Alternatively you can use the [[action:Set_Macro_or_Group_Enable|Set Macro Enable action]]. |
You can rename, create, delete, duplicate macro groups and macros. You can add and remove actions. You can get or set the selection. | You can rename, create, delete, duplicate macro groups and macros. You can add and remove actions. You can get or set the selection. | ||
Line 203: | Line 217: | ||
==== Editor ==== | ==== Editor ==== | ||
- | Another way you can control Keyboard Maestro Editor is using the "`keyboardmaestro`" URL scheme, which supports the following formats: | + | Another way you can control Keyboard Maestro editor is using the "`keyboardmaestro`" URL scheme, which supports the following formats: |
^ Example Editor URL Command ^ Description ^ | ^ Example Editor URL Command ^ Description ^ |