sajad torkamani

Download AutoHotKey.

Open your desktop and right click to open up the context menu. Select New > AutoHotKey script, choose a name (e.g., capslock_remap.ahk) and paste the following contents:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

*CapsLock::
    Send {Blind}{Ctrl Down}
    cDown := A_TickCount
Return

*CapsLock up::
    If ((A_TickCount-cDown) < 200)  ; Modify press time as needed (milliseconds)
        Send {Blind}{Ctrl Up}{Esc}
    Else
        Send {Blind}{Ctrl Up}
Return

Save and close file. Right-click file from desktop and open with the AutoHotKey program.

That should register the necessary hotkeys so that pressing CapsLock on its own makes it act as Escape and pressing it with another key makes it act as the Control modifier.

Tagged: Misc