这个IF语句怎么错了
安装C++2008 如果没安装下面的代码还能用,如果出现替换窗口,ELSEIF后面的就不执行了哪位大虾帮下忙,搞好久了都不行窗口和标题都是对的Dim $bt = "Microsoft Visual C++ 2008 Redistributable Setup"
Run("C2008sp1.exe")
If WinWaitActive($bt, "Welcome to Microsoft Visual") Then
ControlClick($bt, "Welcome to Microsoft Visual", "Button12")
WinWaitActive($bt, "Be sure to carefully read and understand all the rights and ")
ControlClick($bt, "Be sure to carefully read and understand all the rights and ", "Button11")
ControlClick($bt, "Be sure to carefully read and understand all the rights and ", "Button8")
WinWaitActive($bt, "It is highly recommended that you download and")
ControlClick($bt, "It is highly recommended that you download and", "Button2")
ElseIf WinWaitActive($bt, "Select one of the options below") Then
ControlClick($bt, "Select one of the options below", "Button9")
ControlClick($bt, "Select one of the options below", "Button7")
WinWaitActive($bt, "Setup Complete")
ElseIf WinWaitActive($bt, "Error: Another instance of setup is running") Then
ControlClick($bt, "Error: Another instance of setup is running", "Button11")
EndIf
Exit WinWaitActive是个动词,winexists判断窗口是否存在不好吗? 主要是winexists得有个时间问题吧 试试我的想法Dim $bt = "Microsoft Visual C++ 2008 Redistributable Setup",$a=0
Run("C2008sp1.exe")
Do
Sleep(1000)
If WinExists($bt, "Welcome to Microsoft Visual") Then $a=1
If WinExists($bt, "Select one of the options below") Then $a=2
If WinExists($bt, "Error: Another instance of setup is running") Then $a=3
Until $a<>0
If $a=1 Then
WinActivate($bt, "Welcome to Microsoft Visual")
ControlClick($bt, "Welcome to Microsoft Visual", "Button12")
WinWaitActive($bt, "Be sure to carefully read and understand all the rights and ")
ControlClick($bt, "Be sure to carefully read and understand all the rights and ", "Button11")
ControlClick($bt, "Be sure to carefully read and understand all the rights and ", "Button8")
WinWaitActive($bt, "It is highly recommended that you download and")
ControlClick($bt, "It is highly recommended that you download and", "Button2")
ElseIf $a=2 Then
WinActivate($bt, "Select one of the options below")
ControlClick($bt, "Select one of the options below", "Button9")
ControlClick($bt, "Select one of the options below", "Button7")
WinWaitActive($bt, "Setup Complete")
ElseIf $a=3 Then
WinActivate($bt, "Error: Another instance of setup is running")
ControlClick($bt, "Error: Another instance of setup is running", "Button11")
EndIf
Exit "Welcome to Microsoft Visual"和"Select one of the options below"同级? 本帖最后由 smady 于 2011-4-5 16:53 编辑
主要是winexists得有个时间问题吧
dearmb 发表于 2011-4-4 10:49 http://www.autoitx.com/images/common/back.gif
这样怎样?
Dim $bt = "Microsoft Visual C++ 2008 Redistributable Setup"
Run("C2008sp1.exe")
sleep(1000)
if winexists($bt, "Error: Another instance of setup is running") Then
ControlClick($bt, "Error: Another instance of setup is running", "Button11")
elseifWinexists($bt, "Welcome to Microsoft Visual") Then
ControlClick($bt, "Welcome to Microsoft Visual", "Button12")
WinWaitActive($bt, "Be sure to carefully read and understand all the rights and ")
ControlClick($bt, "Be sure to carefully read and understand all the rights and ", "Button11")
ControlClick($bt, "Be sure to carefully read and understand all the rights and ", "Button8")
WinWaitActive($bt, "It is highly recommended that you download and")
ControlClick($bt, "It is highly recommended that you download and", "Button2")
WinWaitActive($bt, "Select one of the options below")
ControlClick($bt, "Select one of the options below", "Button9")
ControlClick($bt, "Select one of the options below", "Button7")
WinWaitActive($bt, "Setup Complete")
endif $bt是你在刚开始定义的,并且你函数里也没让它变呐,当然一直都不变呐
我感觉我帮你改那个应该可以吧,你试试啊 这样怎样?
Dim $bt = "Microsoft Visual C++ 2008 Redistributable Setup"
Run("C2008sp1.exe ...
smady 发表于 2011-4-4 11:04 http://www.autoitx.com/images/common/back.gif
你这样写,如果窗口1秒以上出现,应该就不好使了吧 谢谢你们搞定了下面的经过测试可行Dim $bt = "Microsoft Visual C++ 2008 Redistributable Setup"
Run("C2008sp1.exe")
If WinExists($bt, "Welcome to Microsoft Visual") Then;如果检测到窗口 则运行
WinWaitActive($bt, "Welcome to Microsoft Visual")
ControlClick($bt, "Welcome to Microsoft Visual", "Button12")
WinWaitActive($bt, "Be sure to carefully read and understand all the rights and ")
ControlClick($bt, "Be sure to carefully read and understand all the rights and ", "Button11")
ControlClick($bt, "Be sure to carefully read and understand all the rights and ", "Button8")
WinWaitActive($bt, "It is highly recommended that you download and")
ControlClick($bt, "It is highly recommended that you download and", "Button2")
Exit
ElseIf WinWaitActive($bt, "Select one of the options below") Then
ControlClick($bt, "Select one of the options below", "Button9")
ControlClick($bt, "Select one of the options below", "Button7")
WinWaitActive($bt, "Setup Complete")
ControlClick($bt, "Setup Complete", "Button2")
Exit
ElseIf WinWaitActive($bt, "Error: Another instance of setup is running") Then
ControlClick($bt, "Error: Another instance of setup is running", "Button11")
Exit
EndIf
Exit 学习一下,学习一下 解决了就好。 很好的,学习了。 学习1下,学习1下 2楼谢谢解决了
页:
[1]