Created
December 8, 2024 16:39
-
-
Save Hoekstraa/530b2ccd5d5aec6cce6df881296b1280 to your computer and use it in GitHub Desktop.
dual function keys on Windows
This file contains hidden or 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
#Requires AutoHotkey v2.0 | |
#SingleInstance | |
#MaxThreadsPerHotkey 3 | |
; https://www.autohotkey.com/boards/viewtopic.php?style=19&t=92738 | |
escih := InputHook("B L1 T1", "{Esc}") | |
entih := InputHook("B L1 T1", "{Enter}") | |
*CapsLock:: | |
{ | |
escih.Start() | |
reason := escih.Wait() | |
if (reason = "Stopped") { | |
Send "{Blind}{Esc}" | |
} else if (reason = "Max") { | |
Send "{Blind}{Ctrl down}" escih.Input | |
} | |
} | |
*CapsLock up:: | |
{ | |
if (escih.InProgress) { | |
escih.Stop() | |
} else { | |
Send "{Ctrl up}" | |
} | |
} | |
*Enter:: | |
{ | |
entih.Start() | |
reason := entih.Wait() | |
if (reason = "Stopped") { | |
Send "{Blind}{Enter}" | |
} else if (reason = "Max") { | |
Send "{Blind}{Ctrl down}" entih.Input | |
} | |
} | |
*Enter up:: | |
{ | |
if (entih.InProgress) { | |
entih.Stop() | |
} else { | |
Send "{Ctrl up}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment