This question already has an answer here:
There's plenty of utilities that remap keys, but I can't seem to find a very specific feature: I want to have caps lock act as the control modifier key when held down, but as escape when pressed on its own.
A similar question was posed here, and one of the answers provided an AutoHotkey script, however it is susceptible to the timing of key presses and only handles a hard-coded list of all possible control+letter combinations. I would prefer it if it would function without quirks, blocking caps lock pressed events, storing any other keys pressed while the caps lock key has not yet been released, and then deciding whether to send escape or control.
Is there a simple utility or a more generic AutoHotkey script that does this?