Jump to content

Shortcuts — Run installled macOS shortcuts


Recommended Posts

Usage


Search all your shortcuts via the sc keyword or search by folder name with scd.


sc.png

  • ↩: Run the shortcut.
  • ⌘↩: Run the shortcut with an argument.
  • ⌥↩: Open the shortcut for editing.

Use the Universal Action to run the shortcut on files or as another way to provide an argument.


ua.png


The list of shortcuts is cached for faster results. An immediate cache rebuild can be forced with ⌘⌥⌃↩.


⤓ Install on the Alfred Gallery | Source

 

 

Edited by vitor
Link to comment
  • 3 weeks later...
4 hours ago, Ligeard said:

I send you a private message with the debug infos.

 

Please don’t split the conversation. Either send a private message or post to the thread, not both. Preferably the latter so other people can benefit from the conclusions. Can you check if this one works for you?

Link to comment

With the 2022.1 version of the Alfred Shortcuts workflow, I'm having an issue where if the Shortcut has some sort of output (text) that it would copy to the clipboard ("Copy to Clipboard" step in Shortcuts), that output does not seem to copy to the clipboard. It works just fine in the 2021.1 version. In debugging, the 2022.1 Alfred Shortcuts workflow does run a Run Script step to Copy to Clipboard that does seem to have the correct output within it, but for some reason I'm not able to paste that output — Cmd + V doesn't work, and neither does the output show up in my clipboard history in Alfred. 

 

The final Copy to Clipboard step in the 2022.1 Alfred Shortcuts workflow is not marked as transient; I do see that the "middle" Copy to Clipboard steps are marked as transient, but toggling that only copied the name of the shortcut to the clipboard, not the text output. Seems like something that changed between the 2021.1 version and the 2022.1 version is causing the issue.

 

Overall the workflow is great and thanks so much for releasing it! 🎉

Link to comment

@brian_seidman Nice analysis, you are correct. To circumvent NSTask decomposition I use the clipboard as a temporary placeholder of information but do not pollute the history and restore the clipboard to what it was when the Workflow ends. I hadn’t consider the shortcut itself might change the clipboard and that in that case the Workflow shouldn’t restore it.

 

Just released 2022.2 which fixes it.

Link to comment
  • 2 weeks later...

This is awesome! Alfred rookie here: would it be possible to modify the Alfred Workflow in such a way that "sc" is automatically run upon any input within Alfred? Like the way apps and files are automatically searched when you start typing, I'd love to search for Shortcuts without prefixing my query with 'sc'.

Link to comment
7 minutes ago, rowankaag said:

would it be possible to modify the Alfred Workflow in such a way that "sc" is automatically run upon any input within Alfred?

 

It is not. Alfred works that way by design. Imagine the case where you had one (or multiple!) slow Workflows all trying to shove their results in the regular search. It would be a mess.

Link to comment
6 hours ago, vitor said:

 

It is not. Alfred works that way by design. Imagine the case where you had one (or multiple!) slow Workflows all trying to shove their results in the regular search. It would be a mess.

That does make a lot of sense. Do @Vero / @Andrew / @deanishe or you know if there is “native support” planned (as is the case with files / applications / etc) on the current roadmap for Alfred?

Link to comment
19 hours ago, rowankaag said:

if there is “native support” planned

 

Because the behaviour is on purpose, it’s unlikely it will change unless the reasons for it also do. Files and applications are predictable (i.e. Alfred knows what to expect and can prepare for oddities) but Workflows can be anything.

Link to comment
6 hours ago, felixpy said:

Is it possible to adjust this shortcut to only show shortcuts from a predefined folder e.g. "Mac"?

 

Create a Keyword Input or Hotkey Trigger and connect it to a Show Alfred Utility with argument sc Folder Name (e.g. sc Mac ).


Then whenever you call the Keyword or invoke the Hotkey, it will be repopulated to only show that folder.


Set this up outside the Workflow, in another one, so it doesn’t get overwritten on updates.

Link to comment
  • 5 months later...
  • 2 months later...
  • 2 weeks later...

@vitor

 

Suddenly having some trouble with the Shortcuts workflow; apologies in advance if this gets chalked up to user error. Possibly this is a problem with the Run Shortcuts object, but I figured you’d be able to gauge either way.

 

Basically, I’m able to pass a string to the Shortcuts workflow via Universal Action and Run Shortcut on it, but not a file/folder.

 

I’ve made test shortcuts that receive all types of input and then return a notification. These shortcuts will receive an string argument from Alfred and then correctly return that argument as a notification. If I pass in a file as a string (“Treat Input as String”) in the Run Shortcuts object, the notification returns that file path as a string. But, if I choose “Treat Input as File(s),” the notification is blank and shortcut steps like “Reveal File” don’t take any action, and Quick Look reports nothing was passed via Shortcut Input.

 

I put in a couple of Debugs into your Shortcuts workflow, and it looks like the workflow is passing the right information to the Run Shortcuts object — the JSON Config object is passing an “inputmode” of 1 for files and 0 for strings, etc. That’s why I’m wondering if it’s something in the Run Shortcuts object itself; the correct data is being passed to the Run Shortcuts object, but irrespective if Run Shortcut is directly configured or configured via JSON Config, it still doesn’t seem to function on file arguments. 

 

I have tried regressing my version of the Shortcuts workflow, but that didn’t help. I don’t believe I can download an earlier version of Alfred (back to v5.06), but that would be the next thing I’d try with the newest version of the Shortcuts workflow, again to see if the newest iteration of the Run Shortcuts object in Alfred is causing the issue.

 

I appreciate any insight you can provide. Thanks!

 

P.S. Workaround that does seem to work is getting a file/folder via Universal Action, and then passing that argument to a Run Script object, /bin/zsh, that  runs `shortcuts run SHORTCUT_NAME -i $query`, the command line version of Shortcuts. I don't think that illuminates anything necessarily, except that Shortcuts can indeed take an Alfred argument and run with it, just seemingly not through the Run Shortcuts object.

Edited by brian_seidman
Link to comment
1 minute ago, brian_seidman said:

Basically, I’m able to pass a string to the Shortcuts workflow via Universal Action and Run Shortcut on it, but not a file/folder.

 

It’s not user error, it’s Apple error. The regression is in Shortcuts itself in a recent version of Ventura. We’re aware and it’s already been reported to Apple. Ostensibly Apple gives priority to bugs with multiple reports, so if you’d like to help bump that up create a report with Feedback Assistant with the name Regression: "Shortcuts Events" fails on list of files and in the body mention you’re duplicating FB12163725.

 

It’s not even the only broken feature Shortcuts has, unfortunately. The shortcut has already needed to change once before due to it.

Link to comment
  • 3 weeks later...

Cautiously optimistic about it being fixed. It’s still broken on the current Ventura release (13.5, released on the 24th) but appears to have been fixed on the current Sonoma beta (4, released on the 25th). Hopefully the fix will be retrofitted to the next Ventura release.

 

Edited by vitor
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...