自动热键:有时未单击按钮 [英] autohotkey: sometimes button is not clicked
问题描述
我编写了这样的自动热键脚本来自动登录程序:
I wrote such autohotkey script to auto-logon my program:
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
.
The problem is - sometimes Button1
is not clicked.
When i'm execution script in most cases Button1
is clicked, but sometimes it doesn't.
When script autoexecuted on locked workstation (this is the scenario I actually need), Button1
is never clicked.
我试图在脚本的每一行之后插入Sleep, 1000
,但没有帮助.
I've tried to insert Sleep, 1000
after each line in script but it didn't helped.
问题是为什么,以及如何解决/解决问题
The question is why, and how to fix/workaround the problem
我今天将尝试替换
ControlSend, Edit2, password, User identification
ControlClick, Button1, User identification
使用
ControlSend, Edit2, password{Enter}, User identification
这可能会起作用...
probably this will work...
推荐答案
我花了一个星期的时间来解决我的问题,并最终解决了它.希望这对某人有帮助.
I spent a week tring to solve my problem anf finally resolved it. Hope this will help to someone.
请不要尝试向自动热键发送 CAPITALIZED 字母,而应发送shiftdown
和shiftup
Never try to send CAPITALIZED letter to autohotkey, instead send shiftdown
and shiftup
错误:
ControlSend, Edit2, passworD, User identification
右:
ControlSend, Edit2, passwor{SHIFTDOWN}d{SHIFTUP}, User identification
如果可能的话,最好避免使用ControlClick
.要单击按钮ControlSend
和Space
.
Also it would be better to avoid ControlClick
if possible. To click a button ControlSend
a Space
to it.
这篇关于自动热键:有时未单击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!