找回密码
 加入
搜索
查看: 1668|回复: 1

求教:自动安装中不同情况的判断

[复制链接]
发表于 2010-1-6 01:53:38 | 显示全部楼层 |阅读模式
本帖最后由 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")

If  WinWaitActive("错误","发生错误") Then
    Send("!a")
Else
    WinWaitActive("Lingoes 灵格斯","全文翻译")
    Send("!{F4}")
EndIf
 楼主| 发表于 2010-1-8 03:12:00 | 显示全部楼层
经过这两天的摸索,基本上解决了这个问题。
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
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-29 00:12 , Processed in 0.076375 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表