automator/applescript keypress repeating until released [duplicate]

Solution 1:

I recommend Keyboard Maestro which lets you set up macros with various actions that can be triggered with keyboard shortcuts or other triggers.

Solution 2:

Check out Hammerspoon. It seems to be very fully featured and — like AutoHotkey — offers a programmatic way to do all sorts of OSX automation, in addition to key binding/remapping.

(It takes a plugin based approach. Karabiner, mentioned in an answer above, can be used as a plugin too allowing its functionality to be enhanced in all sorts of ways.)

http://www.hammerspoon.org/

Solution 3:

I use Karabiner. It is a bit of a pain to customize (it uses XML), but it is just as powerful as AHK. It can also move the mouse.

Solution 4:

I use BetterTouchTools. It can emulate button pressees, mouse clicks, lots of useful functions depending on the currently open application.

Ex: F1 in evernote makes text bold, F2 makes text bigger, F3 selects the whole line:
enter image description here

BetterTouchTools was free until very recently. Now it switched to a 'pay as much as you like' model with a minimum of ~2 dollars or so.

However, it's a GUI based automater, it doesn't have the programming features that Autohotkey has. You can however combine multiple actions like activating a window, press a button, hide a window again etc..