#Requires AutoHotkey v2.0
; recommended for performance and compatibility with future autohotkey releases.
#UseHook
#SingleInstance force
InstallKeybdHook()
SendMode "Input"
;; deactivate capslock completely
SetCapslockState("AlwaysOff")
global CapslockIsDown := false
SetTimer(HandleCapslock, 50)
HandleCapslock() {
global CapslockIsDown
if (!CapslockIsDown && GetKeyState("Capslock", "P")) {
CapslockIsDown := true
Send("{Ctrl DownTemp}{Shift DownTemp}{Alt DownTemp}{LWin DownTemp}")
} else if (CapslockIsDown && !GetKeyState("Capslock", "P")) {
CapslockIsDown := false
Send("{Ctrl Up}{Shift Up}{Alt Up}{LWin Up}")
if (A_PriorKey == "Capslock") {
Send("{Esc}")
}
}
}
Hotkey "~Capslock & Space", ToggleOneCommander
ToggleOneCommander(ThisHotkey)
{
app := A_WinDir "\System32\" proc := "OneCommander.exe"
If WinExist("ahk_exe" proc)
If !WinActive() {
WinActivate
} Else
{
WinMinimize
}
Else
{
Run 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\OneCommander.lnk'
}
Return
}