How to run Shortcuts via the Stream Deck

One of the excellent features coming to Shortcuts for Mac is the addition of a scripting capability for the Shortcuts app itself – Apple has added AppleScript support for commands like opening and running shortcuts, even without opening the app at all.

Naturally, I immediately got excited to bring this possibility to life using the Stream Deck, a USB device from Elgato with hardware keys that can be customized to your heart’s extent (including using folders and subfolders):

The Stream Deck software for Mac allows users to add third-party plugins offered by the community, including one such plugin called “Run OSA script” that lets users input a script that gets triggered when the button is pressed:

To take advantage of this plugin, I’d need to write my own AppleScript – something I’m not super familiar with.

Thanks to this tweet from Alex Hay, developer of Toolbox Pro, I knew to use the Script Editor app to look into the capabilities of Shortcuts app by examining its’ AppleScript dictionary – here’s how:

Step 1:
With Script Editor open, navigate to File \> Open Dictionary (or using Command + Option + O):

Step 2:
Select Shortcuts from the list

Step 3:
From the dictionary view, scroll to the bottom to see the Shortcuts apps’ specific suite of classes and commands:

From there, you can see the run command, which requires the name of the shortcut (surrounded in quotes), plus the instructions for background execution:

To run a shortcut in the background, without opening the Shortcuts app, tell 'Shortcuts Events' instead of 'Shortcuts'.

However, since I’m still new to AppleScript, I didn’t immediately know how to implement this – after briefly looking online, I found a Reddit post (from the creator of a similar AppleScript plugin) that explained the basics of what I’d need to surround my command with, and came up with this:

tell application "Shortcuts Events"
run shortcut "Search YouTube"
end tell

By pasting this into a OSA Script action in the Stream Deck interface and switching the name in the script & on the action to match, I got the custom integration working!

Now, I can trigger any one of my shortcuts from the Stream Deck – something dangerous for a person with 900+ shortcuts and 100 folders…

Get your own Stream Deck MK. 2 on Amazon.

This post contains affiliate links – if you take action after clicking on them, I may receive income. This doesn’t cost you anything and offsets the costs incurred to run this site, in addition to your membership. Thanks for your support!

Posts You Might Like

How to quickly link all your YouTube chapter markers using Shortcuts
If you publish YouTube videos or livestreams with chapter markers, you might want to link back to those moments – here's how to generate the full list using Apple's Shortcuts app.
New shortcuts in the Shortcuts Library: Kindle shortcuts
When cleaning up my Kindle over winter break, I put together this set of shortcuts for managing your device, books, and docs.
Guest spot on the iMore show #674: Shortcuts!
Catch the livestream of my appearance on the iMore show, talking all about Siri Shortcuts in iOS 13. I even demo building a shortcut live – but listening along is still good too :)
How to change back to the old Twitter app icon on iOS »
With Twitter being rebranded to X, users are looking for ways to avoid the change and get the old icon back – using Add to Home Screen in Shortcuts.