How to remap Capslock+{?} to Ctrl+Alt+Shift+{?} in AutoHotKey

autohotkey

I want to remap the Caps Lock key to send Ctrl+Alt+Shift, but I want to also send any keys that I pressed after it.

For example, if I press Caps Lock+t then I want AHK to send Ctrl+Alt+Shift+t
likewise, if I press Caps Lock+j then I want to send Ctrl+Alt+Shift+j.

The following doesn't work because it sends it before I press any trailing keys. (i'm doing this so I can map shortcuts to Ctrl+Alt+Shift+[key] and use the Caps Lock key to execute them.

Capslock::send {^~+}

Best Answer

I looked in the AutoHotkey help file under "Remapping keys and buttons". The general pattern is a::b will make pressing key a send key b instead. However, I couldn't get any of the following to work properly.

CapsLock::^!+
CapsLock::^!Shift
CapsLock::^!LShift

But that same help page describes how AutoHotkey internally translates the a::b remapping into two hotkey mappings. I used that example to make the following working script.

*CapsLock::
  SetKeyDelay -1
  Send {Blind}{Ctrl DownTemp}{Alt DownTemp}{Shift DownTemp}
return

*CapsLock up::
  SetKeyDelay -1
  Send {Blind}{Ctrl Up}{Alt Up}{Shift Up}
return
Related Question