Jump to content

Trigger the "Reload Alfred Cache" function via script / programmatically?


Recommended Posts

Hello & happy holidays all 🎄

 

I'm trying to find out, is there a way to trigger the action below via a script/action/Terminal command etc?

image.png.a3a46e267ce90c705cd508bae7ce6472.png

 

I have a workflow that adds the "Alfred:ignore" Finder comment to exclude items from Alfred's results—the only problem is, it doesn't take effect until this cache is reloaded. So it'd be nice if the script could force this to happen. Is there a way? 

Link to comment

You can use AppleScript (which you must already be using to add the comment; what’s your solution?) to tell Alfred to search for reload and press ↵. From a terminal:

 

tell application id "com.runningwithcrayons.Alfred" to search "reload"
tell application "System Events" to key code 36
Edited by vitor
Link to comment
2 hours ago, luckman212 said:

Thanks - no I'm not using AppleScript, I'm using osxmetadata (Python) like this:

 

Of course! I hadn’t recognised you due to the default avatar but now I see the name.

 

2 hours ago, luckman212 said:

Simulating keystrokes is a little clunky for my taste.

 

Agreed, though in this case it shouldn’t be problematic and I’m unsure if there’s a better solution. You could use AppleScript to tell Alfred to quit and open again, but I haven’t tested if that triggers the reload, and it may kill Workflows running at the time.

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