dalimatt Posted January 21, 2015 Posted January 21, 2015 (edited) A simple workflow that uses a hotkey to launch the Alfred Preferences window using applescript. I modified some code that I found on the forums to improve the workflow. If the Alfred Preferences window is closed and the hotkey is pressed the preferences window will open. If the preferences window is already open then the focus will shift to that window, even if it's in a different space. Download on Github Under MIT license Edited January 27, 2015 by dalimatt
vitor Posted January 21, 2015 Posted January 21, 2015 (edited) You shouldn’t be automating keystrokes most of the time, but definitely not when there is an alternative. They may be dependent on the user’s configurations, and GUI scripting is a recipe for unpredictability and disaster. You also don’t need that much code; all of it can be replaced with a single line: tell application "Alfred Preferences" to activate (or activate application "Alfred Preferences"). In addition, a Run NSApplescript isn’t necessarily the best option for this, as you have no use for on alfred_script(q). You should likely be using a Run Script with /usr/bin/osascript. Finally, you can’t release the whole workflow under the MIT license since you don’t own Alfred’s icon (that you are using). Not that Andrew or Vero mind you using the icon for this, probably, but still its license is very likely more restrictive. Edited January 21, 2015 by Vítor
dalimatt Posted January 22, 2015 Author Posted January 22, 2015 You shouldn’t be automating keystrokes most of the time, but definitely not when there is an alternative. They may be dependent on the user’s configurations, and GUI scripting is a recipe for unpredictability and disaster. You also don’t need that much code; all of it can be replaced with a single line: tell application "Alfred Preferences" to activate (or activate application "Alfred Preferences"). In addition, a Run NSApplescript isn’t necessarily the best option for this, as you have no use for on alfred_script(q). You should likely be using a Run Script with /usr/bin/osascript. Finally, you can’t release the whole workflow under the MIT license since you don’t own Alfred’s icon (that you are using). Not that Andrew or Vero mind you using the icon for this, probably, but still its license is very likely more restrictive. Thanks for the in-depth feedback. I'm new and learning, and really like Alfred. I changed to icon to images in the public domain and made some of the modifications you suggested. Also added a script filter so that people can access Alfred Preferences from the launcher (if they like that sort of thing) and it shows a message when the Alfred Preferences are being loaded after being triggered by a hotkey.
vitor Posted January 23, 2015 Posted January 23, 2015 Using a Script Filter is the wrong way entirely; they serve a completely different purpose. What you want is something like this
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