|
我本想制作一个自动创建宽带连接的脚本,因为这脚本打算隐藏运行,所以丢掉了WinWait 语句,改为Sleep语句,以下脚本暂时正确:$Title = "新建连接向导"
ShellExecute("rundll32.exe","netshell.dll,StartNCW")
Sleep(500)
ControlClick($Title,"","[CLASS:Button; INSTANCE:2]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Button; INSTANCE:1]","Check","")
ControlClick($Title,"","[CLASS:Button; INSTANCE:6]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Button; INSTANCE:2]","Check","")
ControlClick($Title,"","[CLASS:Button; INSTANCE:9]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Button; INSTANCE:2]","Check","")
ControlClick($Title,"","[CLASS:Button; INSTANCE:12]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Edit; INSTANCE:1]","EditPaste","DGDSL1234567890")
ControlCommand($Title,"","[CLASS:Edit; INSTANCE:2]","EditPaste","123456")
ControlCommand($Title,"","[CLASS:Edit; INSTANCE:3]","EditPaste","123456")
ControlClick($Title,"","[CLASS:Button; INSTANCE:17]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Button; INSTANCE:1]","Check","")
ControlClick($Title,"","[CLASS:Button; INSTANCE:21]","",1)
添加最小化运行测试一下:$Title = "新建连接向导"
ShellExecute("rundll32.exe","netshell.dll,StartNCW",@ScriptDir,"",@SW_MINIMIZE)
Sleep(500)
ControlClick($Title,"","[CLASS:Button; INSTANCE:2]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Button; INSTANCE:1]","Check","")
ControlClick($Title,"","[CLASS:Button; INSTANCE:6]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Button; INSTANCE:2]","Check","")
ControlClick($Title,"","[CLASS:Button; INSTANCE:9]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Button; INSTANCE:2]","Check","")
Exit
ControlClick($Title,"","[CLASS:Button; INSTANCE:12]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Edit; INSTANCE:1]","EditPaste","DGDSL1234567890")
ControlCommand($Title,"","[CLASS:Edit; INSTANCE:2]","EditPaste","123456")
ControlCommand($Title,"","[CLASS:Edit; INSTANCE:3]","EditPaste","123456")
ControlClick($Title,"","[CLASS:Button; INSTANCE:17]","",1)
Sleep(500)
ControlCommand($Title,"","[CLASS:Button; INSTANCE:1]","Check","")
ControlClick($Title,"","[CLASS:Button; INSTANCE:21]","",1)
1、结果脚本只能运行在Exit之前的语句,打开最小化的窗口为正常化后,发现取消按钮是不可用的,鼠标按下一步即会出错。
2、如果打开最小化窗口为正常化后,一路按上一步到第一个窗口时取消凡灰变亮了,此后手动一路下一步不会出错直到完成。
请问是什么原因导致取消按钮变灰,致使按下一下安装后出错?
请教如何完成这个隐藏自动完成宽带连接的脚本?(请提供源码,谢谢!) |
|