lgjab 发表于 2010-3-10 16:06:19

我是新手,大家来帮帮忙

我试着写了一个qq2009的脚本,如下
Run("qq2009.exe")
WinWait("腾讯QQ2009 安装向导","欢迎使用腾讯QQ2009")
ControlCommand("腾讯QQ2009 安装向导","欢迎使用腾讯QQ2009","Button1","Check")
Send("!n")
WinWait("腾讯QQ2009 安装向导","自定义安装选项")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button9","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button8","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button10","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button11","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button7","UnCheck")
Send("!n")
WinWait("腾讯QQ2009 安装向导","请选择安装路径")
ControlSetText("腾讯QQ2009 安装向导","请选择安装路径","Edit1","d:\backup\qq")
Send("!i")
If WinWait("腾讯QQ2009 安装向导","您选择的目录安装了旧版本") Then
Send("!y")
EndIf
WinWait("腾讯QQ2009 安装向导","安装完成")
ControlCommand("腾讯QQ2009 安装向导","安装完成","Button6","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","安装完成","Button7","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","安装完成","Button8","UnCheck")
Send("!f")
Exit

为什么红色的代码不执行?我去掉if...then ....endif后可以执行,大家给说说,先谢谢了!

jybb001 发表于 2010-3-10 19:37:11

Run("qq2009.exe")
WinWait("腾讯QQ2009 安装向导","欢迎使用腾讯QQ2009")
ControlCommand("腾讯QQ2009 安装向导","欢迎使用腾讯QQ2009","Button1","Check")
Send("!n")
WinWait("腾讯QQ2009 安装向导","自定义安装选项")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button9","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button8","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button10","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button11","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","自定义安装选项","Button7","UnCheck")
Send("!n")
WinWait("腾讯QQ2009 安装向导","请选择安装路径")
ControlSetText("腾讯QQ2009 安装向导","请选择安装路径","Edit1","d:\backup\qq")
Send("!i")
If WinExists("腾讯QQ2009 安装向导","您选择的目录安装了旧版本") Then
Send("!y")
EndIf
WinWait("腾讯QQ2009 安装向导","安装完成")
ControlCommand("腾讯QQ2009 安装向导","安装完成","Button6","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","安装完成","Button7","UnCheck")
ControlCommand("腾讯QQ2009 安装向导","安装完成","Button8","UnCheck")
Send("!f")
Exit

jybb001 发表于 2010-3-10 19:41:14

本帖最后由 jybb001 于 2010-3-10 19:42 编辑

为什么要用ControlCommand呢那么麻烦

以后是我用程序自动生成的代码

; -------安装脚本开始--------By jybb001 QQ:576022718



run("C:\Downloads\QQ2009_chs.exe")
WinWaitActive("腾讯QQ2009 安装向导")
sleep(1520)
ControlClick("腾讯QQ2009 安装向导","","Button1")
sleep(720)
ControlClick("腾讯QQ2009 安装向导","","Button3")
sleep(1360)
ControlClick("腾讯QQ2009 安装向导","","Button11")
sleep(320)
ControlClick("腾讯QQ2009 安装向导","","Button10")
sleep(400)
ControlClick("腾讯QQ2009 安装向导","","Button8")
sleep(400)
ControlClick("腾讯QQ2009 安装向导","","Button9")
sleep(880)
ControlClick("腾讯QQ2009 安装向导","","Button2")
sleep(1360)
ControlClick("腾讯QQ2009 安装向导","","Button2")
sleep(10880)
ControlClick("腾讯QQ2009 安装向导","","Button8")
sleep(320)
ControlClick("腾讯QQ2009 安装向导","","Button7")
sleep(320)
ControlClick("腾讯QQ2009 安装向导","","Button6")
sleep(800)
ControlClick("腾讯QQ2009 安装向导","","Button2")
稍做修改就行了

77342641 发表于 2010-3-11 13:40:48

复制了去试试,感谢!

lgjab 发表于 2010-3-12 20:29:20

谢谢大家!
页: [1]
查看完整版本: 我是新手,大家来帮帮忙