在问这个问题之前,我对问题进行了快速研究,我认为它应该有效。有人可以指出该代码有什么问题吗?我想将特定文本发送到非活动记事本窗口,但我根本没有得到任何响应。
SetTitleMatchMode, 2
IfWinNotexist, Untitled - Notepad
Run, Notepad.exe, , min
WinWait, Untitled - Notepad
ControlSend, Edit1, test1, Untitled - Notepad
sleep, 1000
ControlSend, Edit1, test2, Untitled - Notepad
Sleep, 1000
return
谢谢!
答案 0 :(得分:0)
您提供的代码已经在Windows 7上测试成功。
F3::
SetTitleMatchMode, 2
IfWinNotexist, Untitled - Notepad
Run, Notepad.exe, , min
WinWait, Untitled - Notepad
ControlSend, Edit1, test1, Untitled - Notepad
sleep, 1000
ControlSend, Edit1, test2, Untitled - Notepad
Sleep, 1000
return
记事本中的输出:
test1test2
正如@RobertIlbrink所提到的,根据所涉及的操作系统,会出现一些行为问题。请确认AutoHotkey正在运行最新版本,并跟进更多详细信息,以便我们进一步排查。
根据评论进行修改:
我现在想知道波兰语字母表是否因为WinTitle未匹配而导致脚本失败。
也许尝试以下方法:
F3::
SetTitleMatchMode, RegEx
Match = .*Notatnik
IfWinNotexist, %Match%
Run, Notepad.exe, , min
WinWait, %Match%
ControlSend, Edit1, test1, %Match%
sleep, 1000
ControlSend, Edit1, test2, %Match%
Sleep, 1000
return