Jump to content

How can I use Alfred2 to send a key sequence?


Recommended Posts

AppleScript should be able to do this. Set up a "Run NSAppleScript" action in a workflow and use the following code:

on alfred_script(q)
  tell application "System Events" to key code 111 using {control down, option down}
end alfred_script

If you want it to switch to a particular application first, you can do something like this: 

on alfred_script(q)
  tell application "Safari" to activate

  tell application "System Events" to key code 111 using {control down, option down}
end alfred_script

Just replace Safari with the name of the app you want to activate.

Edited by Clinton Strong
Link to comment

This look about what I want but how do I also include the function key in this example?

 

I'm not 100% sure on this but I don't think function is available as a mod key where you can write it as 'using {function down}' like you can with some of the others. I think you have to use key code for the function key.

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