Autohotkey can';t更改ahk#U类的输入语言#32770
我在电脑上使用几种语言,我经常使用自动热键在它们之间切换 在一种情况下,我编写了一个脚本,在弹出窗口中切换到英语以保存文件或网页,wintitle为Autohotkey can';t更改ahk#U类的输入语言#32770,autohotkey,postmessage,input-language,Autohotkey,Postmessage,Input Language,我在电脑上使用几种语言,我经常使用自动热键在它们之间切换 在一种情况下,我编写了一个脚本,在弹出窗口中切换到英语以保存文件或网页,wintitle为ahk#u class\32770。它不起作用。奇怪的是,同样的代码适用于ahk_exe Explorer.exe窗口 代码如下: #NoEnv #Warn SendMode Input SetWorkingDir %A_ScriptDir% en := DllCall("LoadKeyboardLayout",
ahk#u class\32770
。它不起作用。奇怪的是,同样的代码适用于ahk_exe Explorer.exe
窗口
代码如下:
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
en := DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1)
#if winactive("ahk_class #32770") or winactive("ahk_exe Explorer.EXE")
f4::
PostMessage 0x50, 0, %en%,, A
send,{f4}
return
我做错什么了吗?DllCall可能不适用于所有程序 尝试以下替代方案:
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
#if winactive("ahk_class #32770") or winactive("ahk_exe Explorer.EXE")
f4::
SetInputLang(0x0409) ; english
send,{f4}
return
SetInputLang(Lang){
WinExist("A")
ControlGetFocus, CtrlInFocus
PostMessage, 0x50, 0, % Lang, %CtrlInFocus%
}