Triggering Shortcuts from Alfred on macOS

For any Alfred app users who also like to dabble in Shortcuts, you might get some use from a new Alfred workflow I have published. It allows you to launch shortcuts from Alfred, optionally adding text input, open shortcuts for editing, pass text into shortcuts, choose shortcuts to run by name/folder > name, pass URLs and files to shortcuts via Alfred’s Universal Actions, and copy Shortcuts information to the clipboard. Essentially I wanted to expand on the existing Shortcuts launch options to something I was more used to on the Mac, and was ultimately more accessible for me without the addition of several dozen keyboard combinations or a depth of Stream Deck navigation I would rather not touch.

It is quite similar to the Conductor workflow I created for Keyboard Maestro that’s been mentioned a couple of times on the podcast. So if you like/use that, and also have an interest in Shortcuts I think it will be worth a look

It is an initial release, and so far, only tested by me. Certainly not extensive testing either. So if you do find any issues I need to fix, please do drop a note on this thread.

6 Likes

You are my favorite person on the internet today! I’m so happy I didn’t have to figure this out today!

2 Likes

Great workflow and super-useful. Thanks so much!

Addressing one item in your ThoughtAsylum post, I haven’t had any trouble triggering my shortcuts from Spotlight (though triggering them through Alfred is quicker and more seamless!). At first I thought it was a matter of registering the shortcut as a Quick Action or in the Services Menu via the Shortcuts Details menu, but I just tried it and I was able to trigger individual shortcuts via Spotlight even if they’re not otherwise being shared.

The category they show up under in Spotlight is “Other,” so as a test, you might un-check all other Spotlight categories except “Other” in the Spotlight preferences, and see if you have better luck. I have found that Spotlights is very picky about the shortcut title — typing the shortcut name exactly gets better results than fuzzy search.

But — your Alfred workflow’s ability to send a text input to a Shortcuts shortcut overcomes a big limitation of Spotlight, so thanks again!

Thanks. Glad you find it useful.

I guess there must be something wrong with my Spotlight index, or it’s another spurious Mac Shortcuts bug. With the “Other” option checked, and an exact Shortcuts name entered (I did try it with a capital “O” for “Of” too), it did not yield a Shortcuts result for me.

They just don’t show for me; at least not right now.

I have not tried doing this, but why would unchecking other categories cause something extra to appear in the remaining checked category? I don’t follow that part of the suggestion.

1 Like

Only my general impression (admittedly anecdotal and subjective) that Spotlight is weighting its results; if I have a bunch of files with the same name and I do a Spotlight search, it shows me some of them but not all of them. So I thought maybe as an experiment if you “cleared the deck” so that all Spotlight could return was results in the Other category, maybe that would help narrow down the issue. Just a thought.

Not that you doubt it, but here’s the Apple Support doc that confirms the Shortcut/Spotlight compatibility.

Thanks again!

1 Like

I have been continuing to tinker with Bypass since releasing v1.0. Today I reached the point of releasing v1.1 with a fair bit of extra stuff in it. This includes flows to help build out calls via URLs, shell script, AppleScript, and even Elgato Stream Deck buttons. There are also a few help links built in too.

In addition to the functionality, I have also put together a dedicated documentation page - very much a reference page rather than a how-to page, but it *should* cover all of the triggers and flows.

I have also published a detailed how-to post for how to use Bypass to help you run shortcuts from a Stream Deck.

While I believe I have tested things as much as I reasonably can at this point, I fully expect there is every chance people might run into issues that I have not. As the complexity of the workflow goes up so does the chance of something being missed or an edge case creeping in. If you do come across any issues, please post details here and I will do my best to take a look as the opportunity presents.

2 Likes

Hi! Does the Bypass workflow still work in Alfred 5 and the latest version of Shortcuts in macOS 12.6? I am trying to use Bypass (v1.3) and it doesn’t seem to work for me.

When I enter “sc” or “scrun” in Alfred, my list of shortcuts does not appear and I cannot run any. If I enter “scrunf”, I do get my folders, and I can subsequently run whatever shortcuts are contained in those folders. If I enter “sccopy”, I get a full list of all my shortcuts. I just cannot run an individual shortcut with “sc” or “scrun”. Am I missing something?

Thank you very much for this workflow and for any advice!

@mf88, I’m running Bypass 1.3.0 on Alfred 5.03 [2074] on macOS 12.6 and both sc and scrun are listing shortcuts for me. It’s quite a straight forward process, so there’s not much of anything to go wrong as such.

However, I’ve been thinking over what could be going on and I’ve managed to do something that breaks it and gives the same result as what you are seeing. While I’ll have a go at fixing (and retesting) the issue when I get the time (probably at the weekend), I might be able to give you a quick fix if the issue is what I think it might be (something not related to the Alfred version, but to your shortcuts).

Q) Do any of your shortcut names contain double quotes?

If so, if you change them to single quotes, I think you should have them working.

if you don’t, could you send me the output of sccopy in a direct message on this forum so I can scan through the names of your shortcuts and check for anything that might have an inadvertent impact on the JSON being used behind the scenes. If your shortcut names contain anything personally identifiable or private, please just substitute in some alternative text.

1 Like

Wow, thank you, @sylumer! I did indeed have some shortcuts named with double quotes. Once I changed those, the workflow seems to work properly. Thank you so much for the great workflow and for the timely advice!

v1.3.1 is up on the website now with a fix for this. There’s just an extra line in a few of the behind the scenes scripts that takes any double quotes in the names and prefixes them with an escape character so that the JSON Alfred uses can then be parsed correctly. I’ve run a handful of tests and this seems to work for my test cases.

1 Like

I just installed Bypass 1.5, running on Alfred 5.1.1 - while the majority of Bypass works wonderfully, the external snippet triggers for setting up StreamDeck buttons were not. A little digging revealed that when Alfred imports a workflow, it strips out all the hotkeys and snippet triggers. While I have figured out a couple and manually inserted them, is there some easy way to make sure I assign the right snippet triggers to the right parts of the workflow (e.g screenshots from your workflow page in Alfred)?
Thanks for your marvelous contributions here.

Alfred now strips out snippets and hot keys to ensure there is no clash. I believe users have to add them for themselves.

I have recently (this week) seen a workflow that incorporated something into the configuration to specify some of the triggers. That may well be something I incorporate into a future release.