ControlSend to inactive window - 不起作用
ControlSend to inactive window - doesn't work
在问这个问题之前,我对这个问题进行了快速研究,我真的认为它应该有效。有人可以指出该代码有什么问题吗?我想将特定文本发送到不活动的记事本 window 但我根本没有收到任何回复。
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
谢谢!
您提供的代码已在 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 提到的,根据所讨论的 OS 会出现一些行为问题。请确认 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
在问这个问题之前,我对这个问题进行了快速研究,我真的认为它应该有效。有人可以指出该代码有什么问题吗?我想将特定文本发送到不活动的记事本 window 但我根本没有收到任何回复。
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
谢谢!
您提供的代码已在 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 提到的,根据所讨论的 OS 会出现一些行为问题。请确认 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