Jump to content

How to bind keyword to system shortcuts

Recommended Posts



I would like to create a workflow to bind keywords to useful shortcuts, for example : 


"capture a selection and save to the clipboard" TO Command + Shift + Control + 4


So when I type "capture.." Alfred executes the shortcut Command + Shift + Control + 4


There are more useful shortcuts that I want to integrate : http://despreneur.com/useful-mac-keyboard-shortcuts-worth-memorizing/ so I don't have to learn them..


Alfred already do that with the system commands, when you type shutdown you can shutdown the computer.


How can I create this simple workflow?? I didn't found anything in the KB nor the forum. There is something similar http://zhaocai.github.io/alfred2-keylue-workflow/ but it doesn't work with my use case.


Thanks for support!

Link to comment

Triggering a keyboard shortcut via a keyword is a suboptimal approach. Ideally, you should find the tools that perform the actions you want, and call those. For example, for taking screenshots, screencapture could be used. Keyboard shortcuts can easily change and produce unpredictable outcomes depending on context.

That said, it is possible, and taking “correctness” out of the equation, it could be easier to do, depending on your needs and constraints (like time, patience, and scripting experience). First, some quick resources. See this StackOverflow answer that gives you a quick idea of how commands are structured, and this app that will be useful when you need to find key codes for specific keys.

Here you have an example workflow to help you get started. As you can see, you only need to connect a Keyword node with a Run Script one (be sure to set Language to /usr/bin/osascript), and use a fairly straightforward syntax. That specific example will take a full screen screenshot, equivalent to pressing ⌘+⇧+3 (keycode 20 is 3, which you can find with the application mentioned above).

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