找回密码
 加入
搜索
查看: 3813|回复: 0

[原创] Flashget 3 (快车3)安装脚本

[复制链接]
发表于 2010-3-25 09:02:06 | 显示全部楼层 |阅读模式
Opt("WinDetectHiddenText",1)
Opt("WinTitleMatchMode",4)
Opt("TrayAutoPause",0)

$sAppName =  "“快车(FlashGet) 简体中文版”"
$sInstallerName = "flashgetcn.exe"
$sMsgBox_Title        = "自动安装"

; 此段脚本判断安装文件是否存在,如果不存在显示提示消息框后退出
$sCannotFindInstaller = "安装终止:无法找到安装程序 "
if Not FileExists($sInstallerName) Then
   $MsgBox_Text =  $sCannotFindInstaller & @ScriptDir &"\"& $sInstallerName
   MsgBox(270352, $sMsgBox_Title , $MsgBox_Text, 5)
   Exit
EndIf


; 检测软件是否已安装到目标计算机,如果已安装则提示相关信息并退出自动安装脚本,如果不存在则继续执行脚本
$sSetupBreak        = "安装终止:检测到系统中以下位置已安装"
;v2.0 Later
$sSetupDir =  RegRead("HKLM\SOFTWARE\FlashGet Network\Flashget", "Path")
if @error=0 Then
   $sMsgBox_Text = $sSetupBreak & $sAppName & @CRLF & $sSetupDir
   MsgBox(270384, $sMsgBox_Title, $sMsgBox_Text, 5)
   Exit
EndIf
;V3.0 later
$sSetupDir =  RegRead("HKLM\SOFTWARE\FlashGet Network\Flashget 3", "Path")
if @error=0 Then
   $sMsgBox_Text = $sSetupBreak & $sAppName & @CRLF & $sSetupDir
   MsgBox(270384, $sMsgBox_Title, $sMsgBox_Text, 5)
   Exit
EndIf


; 此段脚本显示确认继续安装消息框,消息框按钮为是和否
$sSureContinue = "将被安装到D盘中,要继续吗?"
$sWarnning = "警告:安装前请先退出所有正在运行的 Windows 应用程序。"
$MsgBox_Text = $sAppName & $sSureContinue & @CRLF & @CRLF & $sWarnning
; 选择“否”则退出,否则继续执行脚本
if (MsgBox(270372, $sMsgBox_Title, $MsgBox_Text, 5) = 7) Then
   ; 退出
   Exit
Else
   ; 执行安装程序
   Run($sInstallerName)   
EndIf


; 显示托盘区提示
$sSetupNow = "正在安装"
$sTrayTip_Text = $sSetupNow & $sAppName
$sTrayTipIcon = 1    ; 0=没有图标(默认), 1=消息, 2=警告, 3=错误
TrayTip($sMsgBox_Title, $sTrayTip_Text, 10, $sTrayTipIcon)


; 定义常量字符串
$TITLE = "快车(FlashGet)"

$Comment1 = "用户许可协议及隐私协议"
$Comment2 = "添加到快速启动栏"
$Comment3 = "安装 Google 工具栏"
$Comment4 = "C:\Program Files\FlashGet Network\FlashGet"
$Comment5 = "正在安装"
$Comment6 = "安装完成"


; 许可验证
WinWait($TITLE, $Comment1)
if Not WinActive($TITLE, $Comment1) Then WinActivate($TITLE, $Comment1)
; 点击“我同意按钮,无快捷键
ControlClick($TITLE, $Comment1, "Button2")


; 安装选项
WinWait($TITLE, $Comment2)
if Not WinActive($TITLE, $Comment2) Then WinActivate($TITLE, $Comment2)
; 去掉勾选选项 “添加到快速启动栏”
if ControlCommand($TITLE, $Comment2, "Button4", "IsChecked", "") Then
   ControlCommand($TITLE, $Comment2, "Button4", "UnCheck", "")
EndIf
; 去掉勾选选项 “添加桌面快捷方式”
if ControlCommand($TITLE, $Comment2, "Button5", "IsChecked", "") Then
   ControlCommand($TITLE, $Comment2, "Button5", "UnCheck", "")
EndIf
; 保留勾选选项 “修改TCP/IP连接数限制”
if Not ControlCommand($TITLE, $Comment2, "Button6", "IsChecked", "") Then
   ControlCommand($TITLE, $Comment2, "Button6", "Check", "")
EndIf
; 保留勾选选项 “作为浏览器默认下载工具”
if Not ControlCommand($TITLE, $Comment2, "Button7", "IsChecked", "") Then
     ControlCommand($TITLE, $Comment2, "Button7", "Check", "")
EndIf
; V3.4新增选项
; 保留勾选选项 “添加多浏览器支持”
if Not ControlCommand($TITLE, $Comment2, "Button8", "IsChecked", "") Then
     ControlCommand($TITLE, $Comment2, "Button8", "Check", "")
EndIf
; 点击“下一步”按钮,快捷键为Alt+N
Send("!n")


; Google 工具栏
WinWait($TITLE, $Comment3)
if Not WinActive($TITLE, $Comment3) Then WinActivate($TITLE, $Comment3)
; 去掉勾选选项1/1 “安装 Google 工具栏”
if ControlCommand($TITLE, $Comment3, "Button4", "IsChecked", "") Then ControlCommand($TITLE, $Comment3, "Button4", "UnCheck", "")
; 点击“下一步”按钮,快捷键为Alt+N
Send("!n")


; 安装位置
WinWait($TITLE, $Comment4)
if Not WinActive($TITLE, $Comment4) Then WinActivate($TITLE, $Comment4)
; 修改安装目录为 D盘
; 移动光标到当前控件的最前面,接着删除第一个字母 C,最后输入字母 D
Send("{Home}{Delete}D")
; 点击“下一步”按钮,快捷键为Alt+N
Send("!n")


; 正在安装
WinWait($TITLE, $Comment5)
if Not WinActive($TITLE, $Comment5) Then WinActivate($TITLE, $Comment5)
; 灰化按钮 “取消”
;ControlDisable($TITLE, $Comment5a, "[CLASS:Button; INSTANCE:3]")


;安装完成
WinWait($TITLE, $Comment6)
if Not WinActive($TITLE, $Comment6) Then WinActivate($TITLE, $Comment6)
;点击“完成”按钮,快捷键为Alt+F
Send("!f")


; 结束FlashGet安装程序,避免后面的弹出"欢迎"窗口和自动运行FlashGet
ProcessClose("flashgetcn.exe")


; 删除注册表中的自动运行项
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "FlashGet 3")


; 退出脚本程序
Exit
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-22 16:23 , Processed in 0.069359 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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