Jump to content

Using hotkeys to trigger keyboard macros with AppleScript


Recommended Posts

Hey, I'm trying to use Alfred Workflows to have key shortcuts trigger macros that enter specific keystrokes.

 

So far the only way I've managed to do that is with a workflow running AppleScripts on hotkey press.

 

That works, but I find that the delay until the script executes is a bit too long for this purpose, even with the caching enabled.

 

Is there any way to decrease the delay or is there better way to do this with Alfred? Thanks.

 

https://www.dropbox.com/s/ep6lrwzbo2nuj6u/Screenshot%202015-03-31%2000.31.23.png?dl=0

Link to comment

As far as I'm aware, AppleScript and System Events is the only way to enter keystrokes (unless the application you want to enter the text in has its own API to do what you want).
 
It is slow, and should really be a last resort when it comes to automation. In fact, you often have to include an extra delay to give the app time to activate, so the keystrokes go to the right app.
 
What is it exactly you're trying to achieve? (Entering keystrokes is a means to an end. What is that end?)

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