Created
September 26, 2017 14:47
-
-
Save volks73/1e889e01ad0a736159a5d56268a300a8 to your computer and use it in GitHub Desktop.
AutoHotkey script to change Caps Lock to Control on hold and Escape on press and release
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Change Caps Lock to Control when held down; otherwise, Escape | |
; | |
; Originally based on the answer provided in | |
; [this](https://superuser.com/questions/581692/remap-caps-lock-in-windows-escape-and-control) | |
; StackExchange SuperUser question. | |
; | |
; A shortcut should be created for this script and placed in the Windows 10 | |
; user's startup folder to automatically enable the feature on boot/startup. | |
; The user's startup folder can be found using the following steps: | |
; | |
; 1. Windows Key+R. The _Run_ dialog will appear. | |
; 2. Enter the following: `%appdata%\Microsoft\Windows\Start Menu\Programs\Startup` | |
; 3. Press Enter key. A file explorer dialog will appear. | |
; | |
; Obviously, [AutoHotkey](https://autohotkey.com/) must be installed for this to work. | |
*CapsLock:: | |
Send {Blind}{Ctrl Down} | |
cDown := A_TickCount | |
Return | |
*CapsLock up:: | |
If ((A_TickCount-cDown)<400) ; Modify press time as needed (milliseconds) | |
Send {Blind}{Ctrl Up}{Esc} | |
Else | |
Send {Blind}{Ctrl Up} | |
Return |
Thank you so much, ahk is so confusing to me! This is exactly what i needed for arrow up key/shift function on my pok3r keyboard:)
Here's my revised version for AHK v2:
*CapsLock::
{
Send "{LControl down}"
}
*CapsLock up::
{
Send "{LControl Up}"
if (A_PriorKey=="CapsLock"){
if (A_TimeSincePriorHotkey < 1000)
Suspend "1"
Send "{Esc}"
Suspend "0"
}
}
@rhh4x0r thank you so much! I’ve been trying to find a working version for v2 for a while
@rhh4x0r LifeSaver man, it works perfectly!
Thanks @rhh4x0r!
maybe add following line at the beginning to disable capslock completely.
SetCapsLockState 'AlwaysOff'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. After trying out a few other options. This seems to be working the most consistent.