#Cs ____________________________________
脚本功能: 试图自动安装正版瑞星 2009 全功能杀毒软件(自动填序列号和 ID / 免重启)
#Ce ____________________________________
$Title = 'RiSingInstaller'
If WinExists($Title) Then
OhNo()
EndIf
AutoItWinSetTitle($Title)
Func OhNo()
MsgBox(64 + 262144, ' 老大, 请注意此消息: 貌似本程序已经运行了...', '请'& _
'查看任务栏系统托盘的最左边的图标, 这就退出...', 5)
Exit ; 已经运行了一个进程...
EndFunc ;==>OhNo
$WinTitle = "瑞星全功能安全软件"
Opt("WinTitleMatchMode", 4)
;=================== 判断用户是否已经安装 ====================
$PreSet = RegRead('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ris', 'UninstallString')
$AppDir = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\rising\Ris', 'InstallPath')
$RiSing = $AppDir & '\RsMain.eXe'
If $PreSet <> '' And FileExists($RiSing) Then
MsgBox(48 + 262144, '貌似您已经(正确)地安装了瑞星软件!', '貌似您已经很(正确)地安装了瑞星系列软件!' & @CR & @CR & _
'如果软件运行正常, 我们不建议您重新安装...', 5)
Exit ;==> 如果用户已经安装, 则退出! 否则执行光盘安装, 代码如下:
Else
#Cs
;==================== 判断光驱代码开始 =======================
$Disk = DriveGetDrive("CdRom")
If Not @Error Then
; MsgBox(64+262144,"您有 " & $Disk[0] & " 个光驱", "找到 " & $Disk[0] & " 个光驱",3)
For $i = 1 To $Disk[0]
$CdRom = DriveGetType($Disk[$i])
If $CdRom = 'CdRom' Then
;MsgBox(64+262144,'您的光驱是','您的光驱是: ' & $Disk[$i])
If DriveSpaceTotal($Disk[$i]) = 0 Then
MsgBox(48 + 262144, '哎呀! 实在是不好意思, 出错了啦~~~', '搞了半天, ' & _
'我这才发现: 原来您的光驱 ' & StringUpper($Disk[$i]) & ' 盘里没有光盘! ' & @CR & @CR & _
'可能是光驱的仓门没有关紧! 或者您没有放入瑞星光盘... ',5)
Else
ExitLoop
EndIf
EndIf
Next
$Drive = $Disk[$i]
$File = $Drive & '\Ris\Setup.eXe'
Run($File)
EndIf
EndIf
;=================== 判断光驱代码结束 ====================
#Ce
;==================== 光盘安装版代码 =====================
TrayTip(' 正在自动安装 瑞星 2009 正式版...','请勿做任何操作, 以免发生意外导致程序无法自动完成...',15,4)
Run('Ris\Setup.eXe')
EndIf
$T1 = '瑞星全功能安全软件'
$W1 = 'Simplified Chinese'
$W2 = ' 瑞星欢迎您'
$W3 = ' 最终用户许可协议 '
$W4 = ' 验证产品序列号和用户ID:'
$W5 = ' 定制安装 '
$W6 = ' 选择目标文件夹'
$W7 = ' 选择开始菜单文件夹'
$W8 = ' 安装信息 '
$W9 = ' 瑞星内存病毒查杀'
$WE = ' 结束 '
$WF = ' 完成(&F) '
$T2 = '网络程序设置'
$WA = '瑞星个人防火墙向导'
$T3 = 'Windows 文件保护'
$WB = '取消'
$WC = '是(&Y)'
WinWait($T1,$W1)
ControlClick($T1,$W1,'Button3')
WinActivate($T1,$W1)
ControlClick($T1,$W1,'Button1')
WinWait($T1,$W2)
ControlClick($T1,$W2,'Button2')
WinWait($T1,$W3)
ControlCommand($T1,$W3,'Button6','Check')
ControlClick($T1,$W3,'Button2')
WinWait($T1,$W4)
ControlCommand($T1,$W4,'Button6','Check')
WinWaitActive($T1,$W4)
ControlClick($T1,$W4,'Button2')
WinWaitActive($T1,$W4)
ControlSetText($T1,$W4,"Edit2","序列号1")
WinActivate($T1,$W4)
ControlSetText($T1,$W4,"Edit3","序列号2")
WinActivate($T1,$W4)
ControlSetText($T1,$W4,"Edit4","序列号3")
WinActivate($T1,$W4)
ControlSetText($T1,$W4,"Edit5","序列号4")
WinActivate($T1,$W4)
ControlSetText($T1,$W4,"Edit6","您的瑞星ID号")
WinActivate($T1,$W4)
ControlClick($T1,$W4,"Button2")
WinWait($T1,$W5)
ControlClick($T1,$W5,"Button2")
WinWait($T1,$W6)
;WinActivate($T1,$W6)
;ControlSetText($T1,$W6,"Edit7","D:\Program Files\RiSing\") ; 改变安装目录
ControlClick($T1,$W6,"Button2")
If WinWait('瑞星安装程序 ','',2) Then
ControlClick('瑞星安装程序 ','','Button1')
EndIf
WinWait($T1,$W7)
WinActivate($T1,$W7)
ControlSetText($T1,$W7,'Edit8','瑞星2009正版')
ControlCommand($T1,$W7,'Button12','UnCheck')
ControlCommand($T1,$W7,'Button13','UnCheck')
WinActivate($T1,$W7)
ControlClick($T1,$W7,"Button2")
WinWait($T1,$W8)
WinActivate($T1,$W8)
ControlClick($T1,$W8,"Button2")
If WinExists($T3,$WB) Then
ControlClick($T3,$WB,'Button3')
WinWait($T3,$WC)
ControlClick($T3,$WC,'Button1')
Else
WinWait($T2,$WA)
WinActivate($T2,$WA)
ControlClick($T2,$WA,"Button1")
WinWait($T1,$WE)
WinActivate($T1,$WE)
ControlClick($T1,$WE,"Button19")
WinActivate($T1,$WE)
ControlClick($T1,$WE,"Button3")
EndIf
;---------------- 免重启代码开始 --------------------
$InfDir = @WindowsDir & '\Inf\'
While 1
$SearCh = FileFindFirstFile($IniDir & 'Oem*.Inf')
$InfFile = FileFindNextFile($SearCh)
; MsgBox(0,$InfFile,$InfFile)
ShellExecute('Rundll32', 'SetupAPI,InstallHinfSection DefaultInstall 132 ' & $InfDir & $InfFile)
ExitLoop
WEnd
FileClose($SearCh)
;---------------- 免重启代码结束 --------------------
WinWait($T1,$WE)
WinActivate($T1,$WE)
Send('{Tab}')
WinActivate($T1,$WE)
Send('{Down}')
WinActivate($T1,$WE)
Send('{Space}')
WinActivate($T1,$WE)
Send('{Down}')
WinActivate($T1,$WE)
Send('{Space}')
WinActivate($T1,$WE)
Send('{Down}')
WinActivate($T1,$WE)
Send('{Space}')
WinActivate($T1,$WE)
ControlClick($T1,$WE,"Button3")
$Title = '瑞星全功能安全软件'
$WE = ' 结束 '
WinWait($Title,$WE)
ControlCommand($Title,$WE,'Button7','UnCheck','')
ControlClick($Title,$WE,'Button3')
;=================== 安装代码结束 ====================
#Cs
;---------------- 离线升级瑞星代码开始 ----------------
If MsgBox(36 + 262144, 'OK! 瑞星 2009 已全部安装完毕, 立即升级吗?', '瑞星 2009 全功能'& _
'正式版已安装成功! 要立即升级到较新的版本吗? ') = 6 Then
Run('UpDate.eXe') ;将下载的(或从连机备份出来的)升级包改名为:UpDate.eXe
;****************** 再次免重启 ********************
$IniDir = @WindowsDir & '\Inf\'
While 1
$SearCh = FileFindFirstFile($IniDir & 'Oem*.Inf')
$InfFile = FileFindNextFile($SearCh)
ShellExecute('Rundll32', 'SetupAPI,InstallHinfSection DefaultInstall 132 ' & $IniDir & $InfFile)
ExitLoop
WEnd
;***************************************************
WinWait($Title,$WE)
WinActivate($Title,$WE)
ControlClick($Title,$WE,'Button3')
Else
; Run($RiSing) ;貌似动词瑞星有些多余!因为至安装完就已经自己运行了...
Exit
EndIf
$OK = MsgBox(64 + 262144, 'OK! 瑞星 2009 已全部安装并且升级完毕!', '瑞星 2009 全功能'& _
'正式版安装成功并且已升级到 21.29.42 新版! ',5)
If $OK = 6 Or $OK = -1 Then Run($RiSing)
;---------------- 离线升级瑞星代码结束 ----------------
#Ce
[ 本帖最后由 ahkang 于 2009-3-23 10:46 编辑 ] |