Jump to content

Recommended Posts

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 by dalimatt

Share this post


Link to post

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 by Vítor

Share this post


Link to post

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.

Share this post


Link to post

Using a Script Filter is the wrong way entirely; they serve a completely different purpose. What you want is something like this

uoYaqmk.png

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...