luckman212 Posted December 28, 2020 Share Posted December 28, 2020 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?  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
vitor Posted December 29, 2020 Share Posted December 29, 2020 (edited) 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 December 29, 2020 by vitor Link to comment
luckman212 Posted December 29, 2020 Author Share Posted December 29, 2020 @vitor Thanks - no I'm not using AppleScript, I'm using osxmetadata (Python) like this:  /usr/local/bin/osxmetadata --set com.apple.metadata:kMDItemFinderComment 'Alfred:ignore' "$1"  Simulating keystrokes is a little clunky for my taste. Hope that there will be a more robust way to trigger this via script in the future.  Link to comment
vitor Posted December 29, 2020 Share Posted December 29, 2020 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
luckman212 Posted November 25, 2021 Author Share Posted November 25, 2021 Following up on this one, hoping in the future there's a way to programmatically trigger this reload function! Link to comment
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