#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=ico\2.ICO
#AutoIt3Wrapper_outfile=E:\软件安装\soft.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Soft_2.0
#AutoIt3Wrapper_Res_Description=软件安装管理器
#AutoIt3Wrapper_Res_Fileversion=2.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=版权所有crwmart(C) 2008
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <StaticConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
;检查配置文件
If FileExists(@ScriptDir & "\soft\soft.ini") = 0 Then
MsgBox(64 + 0, "错误", @ScriptDir & "\soft 下缺少soft.ini配置文件!")
Exit
EndIf
Opt("TrayOnEventMode", 1)
Opt("guicloseonesc", 0)
Dim $soft[11], $radio[5], $softR[11], $softN[11], $softE[11]
Dim $Title = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "软件标题", "")
Dim $LOGO = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "LOGO图片", "")
Dim $OEM = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "软件OEM", "")
Dim $len = StringLen($OEM)
$len = $len * 12
Dim $Path1 = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "安装路径", "")
If StringRight($Path1, 1) = "" Then
Dim $Path = StringTrimRight($Path1, 1)
Else
Dim $Path = $Path1
EndIf
Dim $choose1 = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "常用软件", "")
Dim $choose2 = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "可选软件", "")
Dim $Kill = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "自我删除", "")
For $i = 0 To 9
$softN[$i] = IniRead(@ScriptDir & "\soft\soft.ini", $i, "软件名称", "")
$softE[$i] = IniRead(@ScriptDir & "\soft\soft.ini", $i, "文件名", "")
$softR[$i] = IniRead(@ScriptDir & "\soft\soft.ini", $i, "软件介绍", "")
Next
;创建窗体
$Form1 = GUICreate($Title, 440, 342, -1, -1)
$Pic1 = GUICtrlCreatePic($LOGO, 0, 0, 440, 70)
$Label5 = GUICtrlCreateLabel($OEM, 350 - $len, 52, $len, 16)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor($Label5, $GUI_BKCOLOR_TRANSPARENT)
$Group1 = GUICtrlCreateGroup("常用软件", 10, 75, 300, 80)
$Group2 = GUICtrlCreateGroup("可选软件", 10, 160, 300, 60)
$soft[1] = GUICtrlCreateCheckbox("&1 " & $softN[1], 20, 90, 140, 20)
$soft[2] = GUICtrlCreateCheckbox("&2 " & $softN[2], 20, 110, 140, 20)
$soft[3] = GUICtrlCreateCheckbox("&3 " & $softN[3], 20, 130, 140, 20)
$soft[7] = GUICtrlCreateCheckbox("&7 " & $softN[7], 20, 175, 140, 20)
$soft[8] = GUICtrlCreateCheckbox("&8 " & $softN[8], 20, 195, 140, 20)
$soft[4] = GUICtrlCreateCheckbox("&4 " & $softN[4], 165, 90, 140, 20)
$soft[5] = GUICtrlCreateCheckbox("&5 " & $softN[5], 165, 110, 140, 20)
$soft[6] = GUICtrlCreateCheckbox("&6 " & $softN[6], 165, 130, 140, 20)
$soft[9] = GUICtrlCreateCheckbox("&9 " & $softN[9], 165, 175, 140, 20)
$soft[0] = GUICtrlCreateCheckbox("&0 " & $softN[0], 165, 195, 140, 20)
For $i = 0 To 9
GUICtrlSetState($soft[$i], $GUI_DISABLE)
Next
$Group4 = GUICtrlCreateGroup("安装方式", 320, 75, 110, 145)
$radio[1] = GUICtrlCreateRadio("选择全部(&A)", 335, 100, 80, 20)
$radio[2] = GUICtrlCreateRadio("全部清空(&B)", 335, 130, 80, 20)
$radio[3] = GUICtrlCreateRadio("常用软件(&C)", 335, 160, 80, 20)
GUICtrlSetState($radio[3], $GUI_CHECKED)
choose1()
$radio[4] = GUICtrlCreateRadio("可选软件(&D)", 335, 190, 80, 20)
For $i = 1 To 4
GUICtrlSetState($radio[$i], $GUI_DISABLE)
Next
$Group3 = GUICtrlCreateGroup("软件详细信息:", 10, 225, 235, 60)
$Label3 = GUICtrlCreateLabel("www", 25, 247, 215, 32)
GUICtrlSetState($Label3, $GUI_DISABLE)
$input1 = GUICtrlCreateInput($Path, 258, 233, 170, 18)
GUICtrlSetState($input1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("点击选择软件安装路径 (&F)", 258, 260, 170, 23)
GUICtrlSetState($Button1, $GUI_DISABLE)
$Label4 = GUICtrlCreateLabel("", 300, 327, 140, 20, $WS_EX_STATICEDGE)
$Progress1 = GUICtrlCreateProgress(10, 293, 235, 18)
$Button2 = GUICtrlCreateButton("手动选择(&S)", 258, 291, 80, 22)
$Button3 = GUICtrlCreateButton("开始安装(&Y)", 348, 291, 80, 22)
$Graphic1 = GUICtrlCreateGraphic(0, 322, 443, 2, $SS_ETCHEDHORZ)
$Graphic2 = GUICtrlCreateGraphic(290, 326, 2, 17, BitOR($SS_CENTER, $SS_ETCHEDHORZ))
$Graphic3 = GUICtrlCreateGraphic(103, 326, 2, 17, BitOR($SS_CENTER, $SS_ETCHEDHORZ))
$Label1 = GUICtrlCreateLabel(@YEAR & "年" & @MON & "月" & @MDAY & "日", 10, 327, 90, 20)
$Label2 = GUICtrlCreateLabel("技术支持:crwmart", 113, 327, 170, 16)
GUICtrlSetState($Label1, $GUI_DISABLE)
GUICtrlSetState($Label2, $GUI_DISABLE)
GUISetState(@SW_SHOW)
;定义热键
HotKeySet("{ESC}", "Close")
;倒计时设置
AdlibEnable("pro1", 200)
$wait = 0
Func pro1()
GUICtrlSetData($Progress1, $wait)
For $v = 0 To 20 Step 1
If GUICtrlRead($Progress1) = $v * 5 Then GUICtrlSetData($Label4, 20 - $v & "秒后自动安装所选项目")
Next
$wait = $wait + 1
If $wait > 100 Then runsoft()
EndFunc ;==>pro1
;以下为获取窗口事件
While 1
$nMsg = GUIGetMsg()
GetPos()
Select
Case $nMsg = $GUI_EVENT_CLOSE
AdlibDisable()
If $Kill = 1 Then
FileDelete($LOGO)
DirRemove(@ScriptDir & "\soft", 1)
Run(@ComSpec & " /c ping -n 3 127.1>nul & del /q soft.exe", @ScriptDir, @SW_HIDE)
EndIf
ExitLoop
Case $nMsg = $radio[1]
all()
Case $nMsg = $radio[2]
none()
Case $nMsg = $radio[3]
choose1()
Case $nMsg = $radio[4]
choose2()
Case $nMsg = $Button1
Folder()
Case $nMsg = $Button2
selecte()
Case $nMsg = $Button3
runsoft()
EndSelect
WEnd
;选择全部
Func all()
AdlibDisable()
For $i = 0 To 9
GUICtrlSetState($soft[$i], $GUI_CHECKED)
Next
EndFunc ;==>all
;清空所有
Func none()
AdlibDisable()
For $i = 0 To 9
GUICtrlSetState($soft[$i], $GUI_UNCHECKED)
Next
EndFunc ;==>none
;常用软件安装
Func choose1()
AdlibDisable()
none()
For $i = 0 To 9
If StringInStr($choose1, $i) Then
GUICtrlSetState($soft[$i], $GUI_CHECKED)
EndIf
Next
EndFunc ;==>choose1
;可选软件安装
Func choose2()
AdlibDisable()
none()
For $i = 0 To 9
If StringInStr($choose2, $i) Then
GUICtrlSetState($soft[$i], $GUI_CHECKED)
EndIf
Next
EndFunc ;==>choose2
;设置安装目录
Func Folder()
AdlibDisable()
$Path = FileSelectFolder("选择安装目录", "")
GUICtrlSetData($input1, $Path)
EndFunc ;==>Folder
;进行手动选择
Func selecte()
AdlibDisable()
GUICtrlSetData($Label4, "正在进行手动选择...")
For $i = 0 To 9
GUICtrlSetState($soft[$i], $GUI_ENABLE)
Next
GUICtrlSetState($input1, $GUI_ENABLE)
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($radio[1], $GUI_ENABLE)
GUICtrlSetState($radio[2], $GUI_ENABLE)
GUICtrlSetState($radio[3], $GUI_ENABLE)
GUICtrlSetState($radio[4], $GUI_ENABLE)
GUICtrlSetState($Label3, $GUI_ENABLE)
EndFunc ;==>selecte
;安装所选项目,请自行命名0-9软件名称,支持rar/exe/7z
Func runsoft()
$InstallPath = GUICtrlRead($input1)
AdlibDisable()
GUICtrlSetData($Label4, "正在进行软件安装...")
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button3, $GUI_DISABLE)
For $i = 0 To 9
If GUICtrlRead($soft[$i]) = $GUI_CHECKED Then
If StringInStr($softE[$i], ".7z") Then
SplashTextOn("", "" & @CRLF & "正在安装在安装" & $softN[$i], 200, 38, @DesktopWidth - 230, @DesktopHeight - 80, 1, "", 10)
RunWait("soft\7za.exe " & "x " & @ScriptDir & "\soft" & $softE[$i] & " -y -o" & '"' & $InstallPath & '"', @ScriptDir, @SW_HIDE)
ElseIf StringInStr($softE[$i], ".rar") Then
SplashTextOn("", "" & @CRLF & "正在安装在安装" & $softN[$i], 200, 38, @DesktopWidth - 230, @DesktopHeight - 80, 1, "", 10)
RunWait("soft\unrar.exe x -y -o+ " & @ScriptDir & "\soft" & $softE[$i] & " " & '"' & $InstallPath & "" & '"', @ScriptDir, @SW_HIDE)
Else
RunWait(@ScriptDir & "\soft" & $softE[$i] & " -y -o" & '"' & $InstallPath & '"')
EndIf
EndIf
Next
SplashOff()
If $Kill = 1 Then
FileDelete($LOGO)
DirRemove(@ScriptDir & "\soft", 1)
Run(@ComSpec & " /c ping -n 3 127.1>nul & del /q soft.exe", @ScriptDir, @SW_HIDE)
EndIf
Exit
EndFunc ;==>runsoft
;ESC热键设置
Func Close()
If $Kill = 1 Then
FileDelete($LOGO)
DirRemove(@ScriptDir & "\soft", 1)
Run(@ComSpec & " /c ping -n 3 127.1>nul & del /q soft.exe", @ScriptDir, @SW_HIDE)
EndIf
Exit
EndFunc ;==>Close
;对应按钮说明设置
Func GetPos()
Local $a
Local $x1 = " " & $softR[1]
Local $x2 = " " & $softR[2]
Local $x3 = " " & $softR[3]
Local $x4 = " " & $softR[4]
Local $x5 = " " & $softR[5]
Local $x6 = " " & $softR[6]
Local $x7 = " " & $softR[7]
Local $x8 = " " & $softR[8]
Local $x9 = " " & $softR[9]
Local $x0 = " " & $softR[0]
$x = GUICtrlRead($Label3)
$a = GUIGetCursorInfo($Form1)
If $a[4] = 7 And $x <> $x1 Then
GUICtrlSetData($Label3, $x1)
ElseIf $a[4] = 8 And $x <> $x2 Then
GUICtrlSetData($Label3, $x2)
ElseIf $a[4] = 9 And $x <> $x3 Then
GUICtrlSetData($Label3, $x3)
ElseIf $a[4] = 12 And $x <> $x4 Then
GUICtrlSetData($Label3, $x4)
ElseIf $a[4] = 13 And $x <> $x5 Then
GUICtrlSetData($Label3, $x5)
ElseIf $a[4] = 14 And $x <> $x6 Then
GUICtrlSetData($Label3, $x6)
ElseIf $a[4] = 10 And $x <> $x7 Then
GUICtrlSetData($Label3, $x7)
ElseIf $a[4] = 11 And $x <> $x8 Then
GUICtrlSetData($Label3, $x8)
ElseIf $a[4] = 15 And $x <> $x9 Then
GUICtrlSetData($Label3, $x9)
ElseIf $a[4] = 16 And $x <> $x0 Then
GUICtrlSetData($Label3, $x0)
EndIf
EndFunc ;==>GetPos