vitor Posted December 21, 2021 Posted December 21, 2021 (edited) Usage Search all your shortcuts via the sc keyword or search by folder name with scd. ↩: 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. The list of shortcuts is cached for faster results. An immediate cache rebuild can be forced with ⌘⌥⌃↩. ⤓ Install on the Alfred Gallery | Source Edited July 11, 2023 by vitor Jed Fox, cands, Grug and 5 others 6 2
vitor Posted December 21, 2021 Author Posted December 21, 2021 Frequently Asked Questions (FAQ) How do I fix Error: Can't get object. (-1728)? If you don’t see any result with the workflow and the debugger shows a variant of: /Users/yourname/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/E8485762-E031-5F89-A6EA-948BA2B50FF4: execution error: Error: Error: Can't get object. (-1728) You bumped into a known bug with the Shortcuts app. Look at your list of Shortcuts and you’re likely to find two or more shortcuts with the same name (usually New Shortcut 1 or similar). Delete the duplicates and try again. Rebooting your Mac is sometimes necessary. How do I report an issue? Accurate and thorough information is crucial for a proper diagnosis. At a minimum, your report should include:The debugger output of the failing action.Your installed versions of: the Workflow, Alfred, and macOS. Be precise, don’t say “latest”. Grug 1
Ligeard Posted January 11, 2022 Posted January 11, 2022 Thanks for the workflow ! But it doesn't work to me. I send you a private message with the debug infos.
vitor Posted January 11, 2022 Author Posted January 11, 2022 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?
vitor Posted January 16, 2022 Author Posted January 16, 2022 Got no reply but updated the Workflow to that version anyway. I’m confident it’ll work.
brian_seidman Posted January 19, 2022 Posted January 19, 2022 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! 🎉
vitor Posted January 19, 2022 Author Posted January 19, 2022 @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. brian_seidman 1
vitor Posted January 23, 2022 Author Posted January 23, 2022 (edited) Two updates today: When writing an argument to a shortcut, the shortcut’s name will show. Allow multiple paths in File Action. Edited January 23, 2022 by vitor Grug 1
rowankaag Posted February 3, 2022 Posted February 3, 2022 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'.
vitor Posted February 3, 2022 Author Posted February 3, 2022 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.
rowankaag Posted February 3, 2022 Posted February 3, 2022 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?
vitor Posted February 4, 2022 Author Posted February 4, 2022 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.
felixpy Posted February 5, 2022 Posted February 5, 2022 Is it possible to adjust this shortcut to only show shortcuts from a predefined folder e.g. "Mac"? I can't figure out how to tweak the code!
vitor Posted February 6, 2022 Author Posted February 6, 2022 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.
vitor Posted July 13, 2022 Author Posted July 13, 2022 (edited) Updated to 2022.9. Use Alfred 5 Run Shortcuts object. Do not accept new arguments when start from File Action or Universal Action. Remove update conditional. Edited July 13, 2022 by vitor
vitor Posted October 8, 2022 Author Posted October 8, 2022 Updated to 2022.11. Add configurable keyword.
vitor Posted March 21, 2023 Author Posted March 21, 2023 Updated to 2023.2. Cache shortcuts list, which speeds it up for people with hundreds of shortcuts.
vitor Posted April 29, 2023 Author Posted April 29, 2023 Updated to 2023.6. Change cache rebuild shortcut to ⌘⌥⌃↩.
brian_seidman Posted May 9, 2023 Posted May 9, 2023 (edited) @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 May 9, 2023 by brian_seidman
vitor Posted May 9, 2023 Author Posted May 9, 2023 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. Floating.Point and brian_seidman 2
Floating.Point Posted July 31, 2023 Posted July 31, 2023 This one just bit me, leading me here. Maybe it would be worth adding a warning to the Run Shortcut node dialog explaining that 'treat input as File(s)' is currently broken 🤷♂️
vitor Posted August 2, 2023 Author Posted August 2, 2023 (edited) 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 August 3, 2023 by vitor Floating.Point 1
vitor Posted February 28, 2024 Author Posted February 28, 2024 Updated to 2024.1.Skip Input as Universal Action.Remove colons in keyboard shortcuts.Edit shortcut with Automation Task.Add Hotkey.Use JSON caching.Split between shortcuts which take input or not.Convert scd to JXA.Shorter Objective-C functions.Fix typo. jesused and Floating.Point 2
jesused Posted March 31, 2024 Posted March 31, 2024 On 2/28/2024 at 7:14 PM, vitor said: Updated to 2024.1. Skip Input as Universal Action. Remove colons in keyboard shortcuts. Edit shortcut with Automation Task. Add Hotkey. Use JSON caching. Split between shortcuts which take input or not. Convert scd to JXA. Shorter Objective-C functions. Fix typo. Thank you Vitor for this incredible and fantastic workflow!!!!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now