Created
October 29, 2021 10:49
-
-
Save JamesHenry/a5b55cac905903b644d2a41951ab74b6 to your computer and use it in GitHub Desktop.
Script Kit - Say Hello World Shortcut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @type {import("@johnlindquist/kit")} */ | |
// Menu: Say Hello World Shortcut | |
// Description: Trigger macOS Monterey Shortcut from Script Kit | |
// Author: James Henry | |
// Twitter: @MrJamesHenry | |
/** | |
* I have created a Shortcut on my Mac running macOS Monterey called | |
* "Say Hello World". | |
* | |
* There are a couple of options available when it comes to invoking | |
* it programmatically (whether via Script Kit or in general). | |
*/ | |
/** | |
* OPTION 1: | |
* | |
* You can use the `shortcuts` CLI that is preinstalled on macOS | |
* Monterey to run named Shortcuts. | |
*/ | |
await $`shortcuts run "Say Hello World"`; | |
/** | |
* OPTION 2: | |
* | |
* You can use AppleScript to communicate with the "Shortcuts" | |
* application on macOS Monterey to run named Shortcuts. | |
* | |
* NOTE: I first tried to communicate with "Shortcuts Events" per this | |
* video from WWDC 2021, but it does not work: | |
* https://developer.apple.com/videos/play/wwdc2021/10232/?time=1539 | |
*/ | |
await applescript(` | |
tell application "Shortcuts" | |
run the shortcut named "Say Hello World" | |
end tell | |
`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment