Created
September 16, 2015 21:31
-
-
Save Aetet/2be9ff0745b3b4eb4ab3 to your computer and use it in GitHub Desktop.
capslock language switch with autohotkey
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
LOCALE_EN := 0x4090409 | |
LOCALE_RU := 0x4190419 | |
CapsLock:: | |
if WinActive("ahk_class ConsoleWindowClass") { | |
PostMessage, 0x50, 0x02, 0,, A | |
} | |
else { | |
SetFormat, Integer, H | |
WinGet, WinID,, A | |
ThreadID := DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0) | |
InputLocaleID := DllCall("GetKeyboardLayout", "UInt", ThreadID, "UInt") | |
PostMessage, 0x50, 0, % ((InputLocaleID == LOCALE_EN) ? LOCALE_RU : LOCALE_EN),, A | |
SetFormat, Integer, D | |
} | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment