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:Execute_an_AppleScript [2018/07/02 18:32] JMichaelTX Add screenshots and put options in table |
action:Execute_an_AppleScript [2019/07/01 02:46] peternlewis |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{:scripting-icon.png?nolink|}} | ||
====== Execute AppleScript Action ====== | ====== Execute AppleScript Action ====== | ||
Line 13: | Line 12: | ||
^ Setup Option ^ Choices\\ (Default shown first) ^ | ^ 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 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 to the current selection.\\ Pasted in to the current selection.\\ Saved to a variable.\\ Saved to the system or a Named Clipboard.\\ Asynchronously ignored (the script runs while the macro continues on to the next //Action//.) | | + | | 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 immediately continues on to the next //Action//.) | |
Line 25: | Line 24: | ||
{{:action:execute-applescript-example-km8.png?nolink|}} | {{:action:execute-applescript-example-km8.png?nolink|}} | ||
- | --- | + | If the script fails, the action will fail (v9.0+), potentially aborting the macro. |
===== Scripting ===== | ===== Scripting ===== | ||
Line 40: | Line 39: | ||
end tell | end tell | ||
- | tell application currentApp | + | tell application currentAppName |
display dialog "Your message here" with title "Your Title here" | display dialog "Your message here" with title "Your Title here" | ||
end tell | end tell | ||
``` | ``` | ||
- | |||
- | --- | ||
===== Using Keyboard Maestro Variables ===== | ===== Using Keyboard Maestro Variables ===== | ||
Line 63: | Line 60: | ||
tell application "Keyboard Maestro Engine" to set myVar to getvariable "My KM Variable" | tell application "Keyboard Maestro Engine" to set myVar to getvariable "My KM Variable" | ||
</code> | </code> | ||
- | --- | ||
**Using Keyboard Maestro Variables in a Shell Script from AppleScript** | **Using Keyboard Maestro Variables in a Shell Script from AppleScript** |