Autohotkey use CapsLock key as modifier key
How might I use the CapsLock key as a modifier type key in autohotkey?
For example currently I am currently doing the following:
t=0
CapsLock::t:=!t
#If t
y::6
u::7
Ideally I would like to just be able to hold down the CapsLock key to trigger the keys.
Basically is there a similar way of writing the above code except for the following?
CapsLock & y::6
Solution 1:
If hold down CAPS LOCK
u::
if (GetKeyState("CapsLock")=1){
u::6
}
else
{
send u
}
IF TOOGLE CAPS LOCK
u::
if (GetKeyState("CapsLock","t")=1){
u::6
}
else
{
send u
}
Get current keyboard layout
Update:
#If GetKeyState("CapsLock")=1
y::6
u::7
Solution 2:
Here is a much simpler solution:
#SingleInstance, Force
SetCapsLockState, AlwaysOff
;CapsLock & S to open Slack
CapsLock & s::
Run, Slack.exe
Return
Note: this will disable the CapsLock key's default behavior