是可以编写代码的,虽然不能用常规的窗口判断
下面是我以前编写的一个迅雷7自动安装脚本12年1月5日编写的 对应迅雷 7.24.3312Opt("WinTitleMatchMode", 3)
Opt("TrayIconDebug",1)
Run("Thunder7.2.4.3312.exe")
$t="迅雷7安装程序"
Global $dir,$j,$j02
$dir=RegRead("HKEY_CURRENT_USER\Software\autoinstall","installdir")
If $dir="" Then
$dir="C"
EndIf
While 1 ;;;;;循环,直到第一个窗口出现......
If WinExists($t,"软件许可协议")=1 Then
ExitLoop
EndIf
WEnd
Func one() ;;;;;;;;;;;;;;;欢迎
WinActivate($t,"软件许可协议")
ControlClick($t,"软件许可协议","Button1")
EndFunc
Func two() ;;;;;;;选项---选择安装路径
WinActivate($t,"")
ControlSetText($t,"","Edit1",$dir&":\Program Files\Thunder Network\Thunder")
EndFunc
While 1
If WinExists($t,"软件许可协议")=1 Then
one()
ElseIf WinExists($t,"软件许可协议")=0 Then ;第一个窗口消失后,如果没有检测到(因为前面有了循环,所以这时不存在提前判断失误)
If WinExists($t,"")=1 Then ;如果第二部出来了;;;
If ControlCommand($t,"","Edit1","GetLine",1)=$dir&":\Program Files\Thunder Network\Thunder" Then
$j=WinActivate("迅雷7","")
ExitLoop ;;;检查安装路径,如果不不不不正确,执行下面的 two()
Else
two()
EndIf
EndIf
EndIf
WEnd
Func three()
WinActivate($t,"")
ControlClick($t,"","Button1")
EndFunc
Func four()
WinActivate("迅雷7","")
ControlClick("迅雷7","","Button2")
EndFunc
While 1
$j02=WinActivate("迅雷7","")
If WinExists($t,"服务协议")=1 Then
ExitLoop
ElseIf $j02=$j Then
three()
Else
four()
EndIf
WEnd
Func six()
WinActivate($t,"服务协议")
ControlClick($t,"服务协议","Button1")
EndFunc
While 1
If WinExists($t,"服务协议")=1 Then
six()
Else
ExitLoop
EndIf
WEnd
While 1
If ControlGetHandle($t,"","Button7") Then
ProcessClose("Thunder7.2.4.3312.exe")
ProcessClose("Thunder7.2.4.3312.exe")
ExitLoop
EndIf
WEnd
While ProcessExists("Thunder7.2.4.3312.exe")<>0
ProcessClose("Thunder7.2.4.3312.exe")
WEnd
FileDelete(@DesktopCommonDir & "\迅雷高清影片免费下载.*")
FileDelete(@DesktopDir & "\迅雷高清影片免费下载.*")
FileDelete(@DesktopCommonDir & "\迅雷看看-免费高清电影.*")
FileDelete(@DesktopDir & "\迅雷看看-免费高清电影.*")
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run","Thunder")
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run","Thunder")
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run","Thunder")
Exit
迅雷7的安装时比较淫荡的......
经过测试自动安装没有问题。 |