求教:自动安装中不同情况的判断
本帖最后由 howacter 于 2010-1-6 02:04 编辑学习Autoit3不久,写了个灵格斯的自动安装脚本,碰到了一个问题,希望各位大大指教。
问题如下:灵格斯程序在安装时,若已有一个安装好的程序在运行,则在最后一步安装时
会弹出一个错误对话框,否则直接继续安装,安装完成后我想用Alt+F4键关闭主界面,
但在最后一步是总是出错。我用的灵格斯是Lingoes v2.6.3-0.
脚本如下:
Run("lingoes")
WinWaitActive("选择安装语言")
ControlSend("选择安装语言","语言","TNewStaticText1","{Enter}")
WinWaitActive("安装程序 - ","欢迎安装")
ControlSend("安装程序 - ","欢迎安装","TNewStaticText2","!n")
WinWaitActive("安装程序 - ","许可证")
ControlSend("安装程序 - ","许可证","TNewStaticText2","!a")
ControlSend("安装程序 - ","许可证","TNewStaticText2","!n")
WinWaitActive("安装程序 - ","安装文件夹")
ControlSend("安装程序 - ","安装文件夹","TNewNotebookPage2","!n")
WinWaitActive("安装程序 - ","额外任务")
ControlSend("安装程序 - ","额外任务","TNewCheckListBox1","{Tab}")
ControlSend("安装程序 - ","额外任务","TNewCheckListBox1","{Space}")
ControlSend("安装程序 - ","额外任务","TNewCheckListBox1","!n")
WinWaitActive("安装程序 - ","准备安装")
ControlSend("安装程序 - ","准备安装","TNewStaticText2","!i")
IfWinWaitActive("错误","发生错误") Then
Send("!a")
Else
WinWaitActive("Lingoes 灵格斯","全文翻译")
Send("!{F4}")
EndIf 经过这两天的摸索,基本上解决了这个问题。Run("lingoes")
WinWaitActive("选择安装语言","确定")
Send("{ENTER}")
WinWaitActive("安装程序 - Lingoes Translator","欢迎安装")
Send("!N")
WinWaitActive("安装程序 - Lingoes Translator","许可证")
Send("!A")
Send("!N")
WinWaitActive("安装程序 - Lingoes Translator","在哪里安装")
Send("!N")
WinWaitActive("安装程序 - Lingoes Translator","选择额外任务")
Send("!N")
WinWaitActive("安装程序 - Lingoes Translator","准备安装")
Send("!I")
If WinWait("错误","发生错误",5) Then ;此处的限时5秒是根据我自己的电脑设的
Send("!a")
Else
WinWaitActive("Lingoes 灵格斯")
Send("!{F4}")
EndIf
页:
[1]