自动热键仅在特定语言中进行更改

时间:2018-08-26 12:12:12

标签: autohotkey

#If !(langID = "EN")
:?:ign::ing
#If

我尝试使用AutoHotKey制作英语过滤器,但不适用于其他语言。

我测试过指出LangID = 0x0409 / langID = 0000409,但没有用,如何使其起作用?

1 个答案:

答案 0 :(得分:1)

尝试

#If !(GetKeyboardLanguage(WinActive("A")) = 0x0409)  ; English  ; "!" means "NOT"

    :?:ign::ing

#If

GetKeyboardLanguage(_hWnd=0){
    if !_hWnd
        ThreadId=0
    else
        if !ThreadId := DllCall("user32.dll\GetWindowThreadProcessId", "Ptr", _hWnd, "UInt", 0, "UInt")
            return false    
    if !KBLayout := DllCall("user32.dll\GetKeyboardLayout", "UInt", ThreadId, "UInt")
        return false    
    return KBLayout & 0xFFFF
}

https://autohotkey.com/board/topic/116538-detect-which-language-is-currently-on/#entry672236