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?

  • FWIW, whilst I also don't like the answer I posted, I haven't ever experienced any issues with it in practice, so if the answer below isn't working for you (as you state in comments), it's worth trying out, at least.
    – Rich
    Dec 16, 2013 at 10:13
  • The answer you posted to the other question also seems to not work with key chords. Specifically, it seems to work only with right shift. For example, I'm pressing CapsLock+Shift+Tab and trying to get Ctrl+Shift+Tab. Pressing CapsLock+LShift+Tab doesn't seem to generate anything at all, but CapsLock+RShift+Tab works fine.
    – rationalis
    Nov 13, 2014 at 21:28
  • Not sure what's going wrong for you, but CapsLock+LShift+Tab works for me. (e.g. it successfully switches tabs in reverse order in Chrome.) I'm currently running on Windows 8.1 but I'm pretty sure it worked in Windows 7 and Windows 8, too.
    – Rich
    Nov 14, 2014 at 10:13

1 Answer 1


This script registers a single press on CapsLock as a press that lasts less than 400ms, modify that value as needed.

    Send {Blind}{Ctrl Down}
    cDown := A_TickCount

*CapsLock up::
    If ((A_TickCount-cDown)<400)  ; Modify press time as needed (milliseconds)
        Send {Blind}{Ctrl Up}{Esc}
        Send {Blind}{Ctrl Up}
  • For some reason, it doesn't work properly with multiple keystrokes, e.g. Ctrl+Shift+Tab or Ctrl+Alt+Del, although it works fine for 2-key combos like Ctrl-A or Ctrl-Tab.
    – rationalis
    Apr 12, 2013 at 19:20
  • I was missing an * before the first CapsLock hotkey. The Ctrl+Shift combinations will work now. Ctrl+Alt+Del however is a special shortcut that cannot be sent from AutoHotkey. Apr 12, 2013 at 19:49
  • The asterisk doesn't seem to have made any difference for me.
    – rationalis
    Apr 12, 2013 at 21:06
  • works completely fine with ctrl+shift combinations for me. Thanks.
    – Mike H-R
    Oct 2, 2014 at 12:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.