Autohotkey 自动热键:如何避免;“焦点丢失”;问题
我有这样的自动热键脚本:Autohotkey 自动热键:如何避免;“焦点丢失”;问题,autohotkey,Autohotkey,我有这样的自动热键脚本: #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent startin
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Run file.exe # takes ~30 seconds to start
WinWait User identification
Sleep 1000
Send administrator{tab}
Sleep 1000
Send password
Click 38, 196
我在启动时使用此脚本自动登录一个实用程序
问题是-如果此脚本工作时(大约2秒+应用程序启动时间(大约30秒)总共32秒),其他一些程序会弹出一个关于某个内容的窗口(如可用的新更新或防病毒声明或任何内容),则脚本无法工作,因为窗口“用户标识”的焦点丢失
如何解决这个问题?我应该使用其他工具(哪一个)还是可以使用自动热键解决此问题
谢谢我使用了AutoScriptWriter程序,它可以完美地为我生成代码:
Run file.exe
WinWait, User identification,
IfWinNotActive, User identification, , WinActivate, User identification,
WinWaitActive, User identification,
Send, administrator{TAB}password{ENTER}
不过
ControlSend
可能是更好的选择很高兴您能使用它。作为一个提示,也可以看看ControlSend和ControlClick命令。如果在当前脚本输入数据时有内容窃取了焦点,则会导致问题。将击键/单击直接发送到控件更可靠,并且不需要窗口具有焦点。