2011-09-21 156 views
0

我写了这样AutoHotkey的脚本来自动登录我的程序:AutoHotkey的:有时按钮没有点击

SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 
Run info.exe 
WinWait, User identification, 
Sleep 300 
ControlSend, Edit1, user, User identification 
ControlSend, Edit2, password, User identification 
ControlClick, Button1, User identification 

的问题是 - 有时Button1不点击。 当我在大多数情况下执行脚本Button1被点击,但有时它不。 当锁定工作站上的脚本自动执行(这是我实际需要的场景)时,永远不会点击Button1

我试图在脚本中的每行之后插入Sleep, 1000但它没有帮助。

问题是为什么,以及如何修复/解决方法问题

我今天尝试更换

ControlSend, Edit2, password, User identification 
ControlClick, Button1, User identification 

ControlSend, Edit2, password{Enter}, User identification 

也许这将工作...

回答

3

我花了一个星期的时间来解决我的问题,最终解决了这个问题。希望这会对某人有所帮助。

切勿尝试发送用大写信AutoHotkey的,而不是发送shiftdownshiftup

错误:

ControlSend, Edit2, passworD, User identification

右:

ControlSend, Edit2, passwor{SHIFTDOWN}d{SHIFTUP}, User identification

如果可能,最好避免ControlClick。点击一个按钮ControlSend a Space

+0

啊!我希望我早点看到你的帖子。 'ControlSend'是区分大小写的 - 你无意中发现的。 – bgmCoder