luckman212 Posted March 12, 2023 Posted March 12, 2023 Is there any way to programmatically open Alfred's preferences app to specific areas? For example directly to the "Features → Clipboard History" section? Via URL Scheme perhaps?
luckman212 Posted March 12, 2023 Author Posted March 12, 2023 (edited) Until there's a better way, I came up with this poor man's solution... 🤷 #!/usr/bin/env bash # quits Alfred Prefs (if open) and then opens it to the Features -> Clipboard tab bid='com.runningwithcrayons.Alfred-Preferences' osascript <<EOS &>/dev/null with timeout of 5 seconds tell application id "$bid" to quit end timeout EOS defaults write $bid lastFeature clipboard defaults write $bid lastTab features open -b $bid Edited March 12, 2023 by luckman212
vitor Posted March 13, 2023 Posted March 13, 2023 Could you expand on your use case a bit? What would the programatic access give that is not solved for you with the ? search?
luckman212 Posted March 13, 2023 Author Posted March 13, 2023 (edited) Hi @vitor ! The use case is I have a script that does some processing on recent files that are in the clipboard history. For the script filter to work, that feature needs to be enabled. I was able to figure out how to programmatically check for that, but to close the loop I'd like the "action" item from that script filter to directly open Alfred Prefs to the page so the user can enable the checkbox. Indeed, ?clipboard does take me to the correct place! But I was hoping the script could open this for the user automatically. I assume there's probably an undocumented URL scheme available, since I guess that might be how Alfred gets the separate Alfred Preferences.app to open directly to that specific page. Edited March 14, 2023 by luckman212
Andrew Posted April 12, 2023 Posted April 12, 2023 @luckman212 I just shared a bit more info on the prefs internal URL scheme:
luckman212 Posted April 12, 2023 Author Posted April 12, 2023 (edited) @Andrew This is great! Exactly what I was hoping for. Thank you! For reference, here's the URL I used (updated to the new scheme Andrew posted below) open 'alfredpreferences://navigateto/features>clipboard>{history}' Edited April 12, 2023 by luckman212
Andrew Posted April 12, 2023 Posted April 12, 2023 @luckman212 good good If you update to 5.1 b2132, I've actually tweaked the URL scheme to be alfredpreferences://navigateto/... but it'll be backwards compatible with the link you're using (for now). If this URL scheme is ever officially supported, it'll certainly use navigateto/ luckman212 1
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