#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
Opt("TrayiconDebug", 1)
Opt("GUIOnEventMode", 1)
Opt("WinDetectHiddenText", 1)
If WinExists("flash8自动安装") Then
MsgBox(0, "", "Flash8安装已经在运行", 3)
Exit
EndIf
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("flash8自动安装", 300, 80, @DesktopWidth / 2 - 150, @DesktopHeight - 160)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
$Progress1 = GUICtrlCreateProgress(20, 45, 260, 22)
$Label1 = GUICtrlCreateLabel("", 20, 10, 260, 35)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
inst_main()
FileDelete(@ScriptDir & "\flash8.exe")
Run(@ComSpec & ' /c ping 127.0.0.1 -n 3&del /q "' & @ScriptFullPath, @ScriptDir, @SW_HIDE)
ProcessClose(@AutoItPID)
While 1
Sleep(1000)
WEnd
Func _exit()
Exit
EndFunc ;==>_exit
Func inst_main()
Local $hwin, $title
$title = "安装 - Flash 8"
;~ GUICtrlSetState ($progress1,$gui_hide)
GUICtrlSetData($Label1, "开始Flash8安装......")
If WinExists($title) Then ProcessClose("flash8.exe")
Run("flash8.exe")
ConsoleWrite(WinWait($title) & @CRLF)
$hwin = WinGetHandle($title)
WinSetState($hwin, "", @SW_HIDE)
ConsoleWrite($hwin & @CRLF)
WinWait($hwin, "欢迎使用 Flash 8 安装向导")
GUICtrlSetData($Label1, "开始Flash8安装......向导")
ControlClick($title, "欢迎使用 Flash 8 安装向导", "[CLASS:TButton; Text:下一步(&N) >]")
ConsoleWrite(ControlGetText($title, "欢迎使用 Flash 8 安装向导", "TButton1") & @CRLF)
GUICtrlSetData($Progress1, 5)
WinWait($title, "许可协议")
GUICtrlSetData($Label1, "开始Flash8安装......许可协议")
ControlClick($title, "许可协议", "[CLASS:TButton; Text:下一步(&N) >]")
GUICtrlSetData($Progress1, 10)
WinWait($title, "选择目标位置")
GUICtrlSetData($Label1, "开始Flash8安装......选择目标位置")
ControlClick($title, "选择目标位置", "[CLASS:TButton; Text:下一步(&N) >]")
GUICtrlSetData($Progress1, 15)
WinWait($title, "选择组件")
GUICtrlSetData($Label1, "开始Flash8安装......选择组件")
ControlClick($title, "选择组件", "[CLASS:TButton; Text:下一步(&N) >]")
GUICtrlSetData($Progress1, 20)
WinWait($title, "选择开始菜单文件夹")
GUICtrlSetData($Label1, "开始Flash8安装......选择开始菜单文件夹")
ControlClick($title, "选择开始菜单文件夹", "[CLASS:TButton; Text:下一步(&N) >]")
GUICtrlSetData($Progress1, 25)
WinWait($title, "选择附加任务")
GUICtrlSetData($Label1, "开始Flash8安装......选择附加任务")
ControlClick($title, "选择附加任务", "[CLASS:TButton; Text:下一步(&N) >]")
GUICtrlSetData($Progress1, 30)
WinWait($title, "准备安装")
GUICtrlSetData($Label1, "开始Flash8安装......准备安装")
ControlClick($title, "准备安装", "[CLASS:TButton; Text:安装(&I)]")
GUICtrlSetData($Progress1, 35)
$times = 1
While (Not WinExists($title, "Flash 8 安装向导完成"))
$iText = ControlGetText($title, "正在安装", "TNewStaticText3")
$fText = ControlGetText($title, "正在安装", "TNewStaticText4")
GUICtrlSetData($Label1, $iText & ":" & $fText)
$times += 1
If $times > 65 Then $times = 65
GUICtrlSetData($Progress1, 35 + $times)
Sleep(700)
WEnd
WinWait($title, "Flash 8 安装向导完成")
ControlClick($title, "Flash 8 安装向导完成", "TButton4")
GUICtrlSetData($Label1, "安装完成,正在删除安装文件")
Sleep(3000)
ControlClick($title, "Flash 8 安装向导完成,", "[CLASS:TButton; Text:完成(&F)]")
Sleep(3000)
EndFunc ;==>inst_main