Created
September 29, 2019 07:14
-
-
Save emisjerry/056ca22797d5f2fc7af14c9e9fa18df6 to your computer and use it in GitHub Desktop.
使用AutoHotkey快速切換語言鍵盤,和超難用的Ctrl/Alt+Shift說再見!(AHK #9)
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
#SingleInstance Force | |
!1:: | |
SetDefaultKeyboard(0x0409) ;; 切換為英文輸入 | |
return | |
!2:: | |
SetDefaultKeyboard(0x0404) ;; 切換為中文輸入 | |
return | |
!0:: | |
V++ | |
M := mod(V,2) ;; 模數 | |
if M=1 | |
SetDefaultKeyboard(0x0404) ;; 切換為中文輸入 | |
else | |
SetDefaultKeyboard(0x0409) ;; 切換為英文輸入 | |
return | |
SetDefaultKeyboard(LocaleID) { | |
Global SPI_SETDEFAULTINPUTLANG := 0x005A | |
SPIF_SENDWININICHANGE := 2 | |
Lan := DllCall("LoadKeyboardLayout", "Str", Format("{:08x}", LocaleID), "Int", 0) | |
VarSetCapacity(Lan%LocaleID%, 4, 0) | |
NumPut(LocaleID, Lan%LocaleID%) | |
;Lan := 0xE0090404 | |
DllCall("SystemParametersInfo", "UInt", SPI_SETDEFAULTINPUTLANG, "UInt", 0, "UPtr", &Lan%LocaleID%, "UInt", SPIF_SENDWININICHANGE) | |
WinGet, windows, List | |
Loop %windows% { | |
PostMessage 0x50, 0, %Lan%, , % "ahk_id " windows%A_Index% | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
參考看看影片: https://youtu.be/_el0z6Z_61U