Jump to content

Shortcuts — Run installed macOS shortcuts


Recommended Posts

Is it possible to exclude certain folders from the Alfred window results?

 

For example, I have a folder for Shortcuts I've shared externally (ex: to Reddit).  These Shortcuts are sometimes named similarly to the personal Shortcuts I am attempting to run.  Being able to exclude that Reddit-specific folder will make sure I don't trigger the wrong Shortcut.

Link to comment
  • 3 weeks later...

Hi, @vitor . Thanks for creating this amazing workflow! But I have encountered a small issue recently. 

 

The issue being that the workflow couldn't find shortcuts in a recently created folder. It won't show up in the result from keyword `sc` or `scd`. Even after I flushed the cache as in the debugger (didn't know you can do that with the debugger!) and restarted Alfred.

 

image.thumb.png.c9eb58442277c97ce635e5372bc7a05b.png

 

I have 2 shortcuts in the folder ‘Home’. 

 

image.thumb.png.cb3b8076a975f41c9085e7b1e47b1c04.png

 

List shortcuts by folder name 'Home' gives nothing. 

 

Screenshot2024-06-04at7_43_59PM.thumb.png.51380a101a7af27e8ff8133b2d111156.png

 

Search for the shortcut by name gives the same result.

 

But if I move those shortcuts to another folder that I created years ago, I could find them again with the workflow. 

 

I have created several new folders for these shortcuts and tried the same thing. None of the new folders I created today can make the shortcuts contained by them searchable. Only the default ones and the old one works.
 

This behavior seems to be more of a Shortcut app problem at first glance but I think I probably should report it here since someone might already have a workaround or solution. 

 

I also noticed that the 'list shortcuts by folder name' script filter also shows shortcuts not in that folder but whose name containing the name of the folder. 

Link to comment
1 hour ago, spongeblink said:

This behavior seems to be more of a Shortcut app problem at first glance

 

Odds are that’s the case. Shortcuts is frustratingly buggy and the workflow needs to ask it for the information. The first thing you should do is reboot your Mac. More than once I’ve had reports of something not working, we establish Shortcuts is indeed the problem by running the commands outside the workflow, and after much head scratching a reboot magically fixes it.


You can also try this version after the reboot. It has unreleased updates which shouldn’t make a difference in this case.

 

1 hour ago, spongeblink said:

I also noticed that the 'list shortcuts by folder name' script filter also shows shortcuts not in that folder but whose name containing the name of the folder.

 

Yes, that is by design. In addition to being incredibly buggy, Shortcuts is also unbearably slow. By filtering in this manner, we can leverage the cache.

Link to comment
52 minutes ago, vitor said:

The first thing you should do is reboot your Mac

Indeed, rebooting fixed this issue for both my Macs. 👏 I'll try the version you provided anyway. 

1 hour ago, vitor said:

Yes, that is by design. In addition to being incredibly buggy, Shortcuts is also unbearably slow. By filtering in this manner, we can leverage the cache

Got it. Thank you. 

Link to comment

Hey @vitor, sorry to bother you but I have run into another issue. 

 

This workflow now does not give any shortcut in the result. This happened to me after updating from the version you provided to 2024.2 by right clicking the workflow

 

Screenshot2024-06-06at4_07_30PM.thumb.png.c851bf66735f76bc98dc3c712c720e5c.png

 

This only result is one of my own files. 

 

image.thumb.png.13ab5593c04810e17e1b1c608f53b317.png
Same for the "scd" keyword. 

 

This only affected one of my Macs. The same workflow on the other Mac, to which the updated / re-installed versions were synced, worked fine.


I have restarted my Mac and reinstalled this workflow from Alfred Gallery and from the link you provided several times. The result was the same. 

 

I have Alfred 5.5 (2257) and MacOS 14.5 installed. 

 

The debugger showed me this:

[16:24:11.445] Logging Started...
[16:24:13.494] Shortcuts[Script Filter] Queuing argument '(null)'
[16:24:14.095] Shortcuts[Script Filter] Script with argv '(null)' finished
[16:24:14.102] ERROR: Shortcuts[Script Filter] Code 1: /Users/[my user name]/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/E6932170-E048-4F59-A3EA-701BA9B60FF4: execution error: Error: Error: Can't get object. (-1728)

 

But when I type the keyword to revoke the 'List all shortcuts' Script Filter, I can see the 'E6932170-E048-4F59-A3EA-701BA9B60FF4' file (different every time) gets generated there. And after the Alfred window is closed, the file is removed. 

 

Judging by the contents of the same folder on my second Mac, this is where Alfred stores temporary scripts for the Script Filter and Run Script objects. But all my other workflows that utilize these objects work fine. Similarly named text files get generated (and sometimes removed afterwards) as I run the workflow. 

 

This is about all I'm observing right now. 

Link to comment
1 hour ago, spongeblink said:

ERROR: Shortcuts[Script Filter] Code 1: /Users/[my user name]/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/E6932170-E048-4F59-A3EA-701BA9B60FF4: execution error: Error: Error: Can't get object. (-1728)

 

That’s a Shortcuts error that gets fixed by rebooting. It was the original head banger. If that didn’t fix it this time, I’d recheck the permissions.

Link to comment
Posted (edited)

Hey, @vitor, thanks for the reply!

I tried to re-grant all permissions for Alfred followed by resetting it again, restarting Mac, then re-granting it. And I still get the same error. No shortcut showed up in the result.

And maybe you already know it but I just noticed that you have a typo in the title of this topic. 🤐

Edited by spongeblink
Link to comment
  • vitor changed the title to Shortcuts — Run installed macOS shortcuts
54 minutes ago, spongeblink said:

And I still get the same error.

 

Please try this and this and report back.

 

52 minutes ago, spongeblink said:

I just noticed that you have a typo in the title of this topic.

 

Nice spot. Thank you. I wonder how that got in there, since I usually copy it straight from the workflow but it’s correct there. Fixed.

Link to comment

Hi, @vitor! Thanks to those commands, I might have noticed what went wrong…

 

The first command gave similar result like what the user on GitHub got but the second one stoped on the 'Can't get object. (-1728)' error when the loop reached on a Shortcut:

 

/* folder:  */

app = Application("Shortcuts Events")

app.shortcuts.byName("New Shortcut 1").name()

--> Error -1728: Can't get object.

Result:

Error -1728: Can't get object.

Then I searched for the name '
New Shortcut 1' in Shortcut app and noticed that I have two shortcuts with the same name. I think I created them on my iPhone last night, without modifying the names. I don't know why Shortcut app allowed that and why it didn't synced to my second Mac but just to this Mac… As you said, this app is buggy!

 

After I removed those 2 Shortcuts (those were for tests anyway), the workflow functions normally! Thank you.

Link to comment
9 minutes ago, spongeblink said:

I don't know why Shortcut app allowed that and why it didn't synced to my second Mac but just to this Mac… As you said, this app is buggy!

 

Anecdotally, that happens to me constantly. Building a shortcut on macOS to use on iOS is a real pain (but so is making the shortcut directly on a phone). Some shortcuts sync, others don’t, deleted shortcuts remain on one device… It always requires manual fiddling, which is extremely hard as there’s no way to force a sync.

 

12 minutes ago, spongeblink said:

After I removed those 2 Shortcuts (those were for tests anyway), the workflow functions normally! Thank you.

 

Great, glad you’re sorted! Have a nice weekend.

Link to comment
  • 2 weeks later...
On 6/5/2024 at 3:20 PM, vitor said:

Updated to 2024.2.

  • Add configuration to ignore folders by name.
  • Do not close window when going from folders to results.
  • Set screenshot DPI to 144.

 

 

Hello, vitor

Thank you very much, I loved this workflow, but it keeps failing me...

PROBLEM: I enter sc and when I press the space key it says "Shorts - Get shortcuts..." and when it finishes it disappears. If I write scd + space, then the name of the shortcut folders appears to me, but when I press one of them, the same thing happens again: "Shouts - Get shortcuts..." and it doesn't find anything...

WHAT I HAVE DONE:

1-. I have restarted Alfred and the Mac.

2-. I have removed Alfred from "Privacy and Security -> Accessibility" and I have added it again, I start with Alfred and it doesn't solve it.

3-. I went here https://github.com/alfredapp/shortcuts-workflow/issues/11 and I have executed

Quote

Application("Shortcuts Events").shortcuts()

And everything went well (show the shortcuts in the script).

4- I have executed: https://github.com/alfredapp/shortcuts-workflow/issues/11#issuecomment-2034714100 and it tells me:

Resultado:

Error -1728: No se puede acceder al objeto.

 

Could it be a permit problem?

Thank you and sorry for taking your time :)

 

 

ssdfsd.png

CleanShot 2024-06-16 at 14.30.10@2x.png

CleanShot 2024-06-16 at 14.49.13@2x.png

Link to comment
6 hours ago, spongeblink said:

Hi, @jesused, is this the case for you? Try to rename those Shortcuts and try again if it is. 

Wow!!!

 

Thank you friend!!! I had a new shortcut 1... up to a new shortcut 6.

I have eliminated all from 1 to 6 and magically it works correctly now!!!

THANK YOU VERY MUCH!!!!!

Link to comment

Issue with Alfred “Shortcuts” Workflow Not Functioning Properly

 

I can’t get the Alfred Shortcuts workflow to work. It installs and pops up once, then stops. See the video.

 

I have the Alfred Legacy Powerpack. A few workflows pop and go away and do not work. All Shortcuts Keyword: SSC.

 

I have uninstalled and reinstalled, configured, deleted, and reconfigured, but I still get the same result. The workflow pops up quickly in the Alfred search bar and then goes away. As you can see in the video here, (Press Play in lower left corner) the shortcut is available, but when I press enter, nothing happens. It reverts back to the initial search bar, or it may cancel or crash out in the background.

I have the Alfred Legacy Powerpack, using Alfred 5.5 [2257].

 

Can anyone help get this to work or has anyone had similar issues and can share a configuration that sorts this out?

image.thumb.jpeg.9f28c7b3c613b44b2948ccd0fdd7dbb5.jpegAboutAlfred.thumb.png.ec32749f5ecc14206cf7cafbe8232fe2.png

Link to comment

Welcome to the forum.

 

Please open the debugger, run the problem workflow and post the complete output in a new post in this thread. (As a general principle, if you have a problem with a workflow that has a thread on the forum it's best to post in that thread so that the developer of the workflow will see it.)

 

Stephen

Link to comment

Hi Stephen_C,

Thanks a lot for the advice. I'm a novice in forums and debugging. Can I link this thread and post on the workflow's thread to keep this thread and interaction in one place, avoid duplicate threads, and avoid confusing things?

 

Here are the bug results:

[10:29:50.148] Shortcuts[Script Filter] Queuing argument '(null)'

[10:29:50.378] Shortcuts[Script Filter] Script with argv '(null)' finished

[10:29:50.383] ERROR: Shortcuts[Script Filter] Code 1: /Users/mortypetersen/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/AF52137F-21FD-4EFB-9C9E-024453A21D1B: execution error: Error: Error: An error occurred. (-1743)

[10:30:09.657] Shortcuts[Script Filter] Queuing argument '(null)'

[10:30:09.788] Shortcuts[Script Filter] Script with argv '(null)' finished

[10:30:09.793] ERROR: Shortcuts[Script Filter] Code 1: /Users/mortypetersen/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/B81B5D18-CDD7-450C-B731-C7BD7A811BD5: execution error: Error: Error: An error occurred. (-1743)

 

Thanks again.. 

Edited by MortyP
Link to comment

I have some problems with this as well:


I have tried these suggestions with no success:

1. Rebooting the Mac, as Shortcuts can be buggy.

2. Providing detailed information when reporting issues, including versions of the Workflow, Alfred, and macOS, along with debugger output.

3. Using the Universal Action to run shortcuts on files.

4. Creating a Keyword Input or Hotkey Trigger for specific folder shortcuts.

Link to comment
2 hours ago, MortyP said:

I'm a novice in forums and debugging.

Don't worry about that: I think I'm a novice moderator because I can't work out how to move this thread to the thread of the relevant workflow. 😀

 

Anyway, having looked at that thread I think it might just be worth checking that you don't have two shortcuts with the same name. If you do, try deleting one of them and see if the workflow then works. If that doesn't solve the issue and you've not rebooted your Mac for some time try rebooting.

 

Stephen

Link to comment

Thanks –

I added some context to the Shortcuts thread and linked this thread to it, so I consider that fixed. 😉

 

 

It's my understanding that Apple already prevents any one shortcut from being named the same, even in separate Shortcuts folders within the app, so I have no duplicate shortcuts.

 

Link to comment
17 minutes ago, Stephen_C said:

Just to be absolutely sure (see the post immediately above yours) you don't have any shortcuts named in the way mentioned in that post?

 

Stephen

Oh lawd!

I had 458 shortcuts ten minutes ago. I deleted all the *Shortcut 1*, *Shortcut 2*, *Shortcut 3* type ones, with just a number at the end differentiating them. Now I'm down to "only" 422. I do have similar starting titles but with different shortcut names as a whole. I read somewhere that this workflow does have its flaws and quirks, but this should not be a difficult search query, as it should search for the unique name in the shortcut’s name file. However, I don't think I'm up to editing all my shortcuts to remove the spaces to make them unique, as I use shortcuts heavily, which are important to me. This might just be too time-consuming. 

Is there a script or automation that can make these unique, like the Finder app, which allows you to multi-select and rename?

Despite the chaAaful that there's a solution out there. This community has been super helpful, and I'm wondering if there's another workaround other than going through these 400 shortcuts? I might have to give up on this ingenious workflow, but I'm not ready to throw in the towel just yet.

 

2024-06-20_13-27-49.png

Link to comment

There’s no quirk with the workflow. It asks macOS for the shortcuts list (via the official AppleScript API) and acts on that, that’s it. Every time someone has had an issue, it has been a problem with the results returned by macOS. Which is why debugging steps always include running the commands outside the workflow itself for confirmation. The Shortcuts app is frequently broken, and every other release I need to open a new bug report with Apple. In a Ventura they completely broke running shortcuts with files, and more recently the Imgur action has been non-functional for a long time. As you can imagine it’s pretty frustrating to deal with bugs outside your control. That is, unfortunately, something every developer making stuff for Apple platforms is familiar with.

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...