Skip to content

Instantly share code, notes, and snippets.

@jordanrobinson
Created February 1, 2021 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanrobinson/9b7373f9d5ff84ca51121f15dd9db3f4 to your computer and use it in GitHub Desktop.
Save jordanrobinson/9b7373f9d5ff84ca51121f15dd9db3f4 to your computer and use it in GitHub Desktop.
SetDefaultKeyboard(LocaleID){
Static SPI_SETDEFAULTINPUTLANG := 0x005A, SPIF_SENDWININICHANGE := 2
Lan := DllCall("LoadKeyboardLayout", "Str", Format("{:08x}", LocaleID), "Int", 0)
VarSetCapacity(binaryLocaleID, 4, 0)
NumPut(LocaleID, binaryLocaleID)
DllCall("SystemParametersInfo", "UInt", SPI_SETDEFAULTINPUTLANG, "UInt", 0, "UPtr", &binaryLocaleID, "UInt", SPIF_SENDWININICHANGE)
WinGet, windows, List
Loop % windows {
PostMessage 0x50, 0, % Lan, , % "ahk_id " windows%A_Index%
}
}
ToggleInputLang()
{
WinExist("A")
ControlGetFocus, CtrlInFocus
PostMessage, 0x50, 2,, %CtrlInFocus%
}
^!1::Send {Media_Play_Pause}
^!+Space::
ToggleInputLang()
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment