Autohotkey use CapsLock key as modifier key

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


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