Adobe Reader 8 安装脚本
1安装前会判断安装程序是否存在, 延时5秒自动退出2.安装前会判断系统中是否已安装"Adobe Reader 8", 延时5秒自动退出
3.安装前有用户确认的消息框,延时5秒按确认处理
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=AutoSetup.ico
#AutoIt3Wrapper_outfile=AdobeReder8-D.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Description=自动安装Adobe Reader 8中文版到D盘
#AutoIt3Wrapper_Res_Fileversion=1.0.0.35
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=(C)Copyright 2008. All Rights Reserved.
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Res_Field=程序设计|Jinming yang
#AutoIt3Wrapper_Res_Field=发布日期|2009-08-05
#AutoIt3Wrapper_Res_Field=适用版本|AdobeReder 8
#AutoIt3Wrapper_Res_Field=源文件名|AdobeReder8-D.exe
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=213141
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
Opt("WinDetectHiddenText",1)
Opt("WinTitleMatchMode",4)
Opt("TrayAutoPause",0)
$sInstallerName = "AdbeRdr_zh_CN.exe"
$sAppName ="“Acrobar Reader 简体中文版”"
$sMsgBox_Title = "自动安装"
; 此段脚本判断安装文件是否存在,如果不存在显示提示消息框后退出
$sCannotFindInstaller = "安装终止:无法找到安装程序 "
if Not FileExists($sInstallerName) Then
$MsgBox_Text =$sCannotFindInstaller & @ScriptDir &"\"& $sInstallerName
MsgBox(270352, $sMsgBox_Title , $MsgBox_Text, 5)
Exit
EndIf
; 此段代码检测目标系统中是否已安装过此软件
; 检测的方法是读取注册表中的键值,读取成功则说明软件已安装过
$sSetupBreak = "安装终止:检测到系统中以下位置已安装 "
$sSetupDir = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe", "Path")
; @error=0表示读取成功,显示消息框告诉用户相应的信息并退出
if @error=0 Then
$sMsgBox_Text = $sSetupBreak & $sAppName & @CRLF & $sSetupDir
MsgBox(270384, $sMsgBox_Title, $sMsgBox_Text, 10)
Exit
EndIf
; 此段脚本显示确认继续安装消息框,消息框按钮为是和否
$sSureContinue = "将被安装到D盘中,要继续吗?"
$sWarnning = "警告:安装前请先退出所有正在运行的 Windows 应用程序。"
$MsgBox_Text = $sAppName & $sSureContinue & @CRLF & @CRLF & $sWarnning
; 选择“否”则退出,否则继续执行脚本
if (MsgBox(270372, $sMsgBox_Title, $MsgBox_Text) = 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)
;定义常量字符串
$WizardTitle = "Adobe Reader"
$WinInstallerTitle = "Windows Installer"
$WinInstallerComment = "正在准备安装"
$WizardText0 = "暂停"
;$WizardText1 = "欢迎使用"
$WizardText2 = "目的地文件夹"
$WizardText2a = "更改当前目的地文件夹"
$WizardText3 = "已做好安装程序的准备"
$WizardText4 = "正在安装"
$WizardText5 = "安装完成"
; 解压过程
WinWait($WizardTitle, $WizardText0)
if Not WinActive($WizardTitle, $WizardText0) Then WinActivate($WizardTitle, $WizardText0)
;禁用“暂停”按钮
ControlDisable($WizardTitle, $WizardText0, "Button1")
;禁用“退出”按钮
ControlDisable($WizardTitle, $WizardText0, "Button3")
;“Windows Installer"窗口
WinWait($WinInstallerTitle, $WinInstallerComment)
if Not WinActive($WinInstallerTitle, $WinInstallerComment) Then WinActivate($WinInstallerTitle, $WinInstallerComment)
;禁用“取消”按钮
ControlDisable($WinInstallerTitle, $WinInstallerComment, "Button1")
; "目标文件夹"窗口
WinWait($WizardTitle, $WizardText2)
if not WinActive($WizardTitle, $WizardText2) then WinActivate($WizardTitle, $WizardText2)
;点击“更改目标文件夹(D)”按钮,快捷键为Alt+D
Send("!d")
;ControlClick($WizardTitle, $WizardText2, "Button3")
; “更改当前目的地文件夹” 窗口
WinWait($WizardTitle, $WizardText2a)
if not WinActive($WizardTitle, $WizardText2a) then WinActivate($WizardTitle, $WizardText2a)
; 修改盘符为D,路径为 D:\Program Files\Adobe\Acrobat 7.0\
Send("{Home}{Delete}D")
; 点击“OK”按钮,快捷键为ALT+O
Send("!o")
; 返回 “目标文件夹” 窗口
WinWait($WizardTitle, $WizardText2)
if not WinActive($WizardTitle, $WizardText2) then WinActivate($WizardTitle, $WizardText2)
;点击“下一步”按钮,快捷键为Alt+N
Send("!n")
; “准备安装程序” 窗口
WinWait($WizardTitle, $WizardText3)
if not WinActive($WizardTitle, $WizardText3) then WinActivate($WizardTitle, $WizardText3)
;点击“安装”按钮,快捷键为Alt+I
Send("!i")
; “正在安装 窗口
WinWait($WizardTitle, $WizardText4)
if not WinActive($WizardTitle, $WizardText4) then WinActivate($WizardTitle, $WizardText4)
;禁用“取消”按钮
ControlDisable($WizardTitle, $WizardText4, "Button3")
; “安装完成” 窗口
WinWait($WizardTitle, $WizardText5)
if not WinActive($WizardTitle, $WizardText5) then WinActivate($WizardTitle, $WizardText5)
Send("!f") ;点击“完成”按钮,快捷键为Alt+F
; 写注册表,接受最终用户许可协议,以免第一次运行程序时弹出窗口
RegWrite("HKCU\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer", "EULA", "REG_DWORD", "1")
; 退出脚本程序
Exit 恩,不错,学习了
页:
[1]