#include <Constants.au3 >
#include <WinAPI.au3>
#include <WinAPIEx.au3>
#include <Misc.au3>
#include <ProgressConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region
$Form1_SoftInstall = GUICreate("Soft_Name", 552, 393, 193, 131)
$Group1 = GUICtrlCreateGroup(" 选择软件: ", 8, 96, 537, 245)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Button1 = GUICtrlCreateButton("安装", 352, 360, 75, 25)
Global $Button2 = GUICtrlCreateButton("退 出", 440, 360, 75, 25)
Global $Radio1 = GUICtrlCreateRadio("全选", 216, 364, 57, 17)
Global $Radio2 = GUICtrlCreateRadio("全不选", 280, 364, 65, 17)
$Pic1 = GUICtrlCreatePic("", 0, 0, 609, 105)
GUISetState(@SW_SHOW)
#EndRegion
If Not FileExists(@ScriptDir & "\test.ini") Then
MsgBox(0, "配置文件不存在", "找不到:" & @ScriptDir & "\test.ini")
Exit
EndIf
Global $secNamesArray = IniReadSectionNames(@ScriptDir & "\test.ini")
If @error Then
MsgBox(0, "配置文件为空", "请检查:" & @ScriptDir & "\test.ini")
Exit
EndIf
Global $secCnt = $secNamesArray[0]
Global $Checkbox1[$secCnt][3]
For $i = 0 To $secCnt - 1
$Checkbox1[$i][1] = $secNamesArray[$i + 1]
$Checkbox1[$i][0] = GUICtrlCreateCheckbox($Checkbox1[$i][1], _Iif($i < 5, 60, 330), 120 + Mod($i, 5) * 35, 193, 33)
$Checkbox1[$i][2] = IniRead(@ScriptDir & "\test.ini", $Checkbox1[$i][1], "文件名", "没有读到")
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio1
SetAllCheckBox(True)
Case $Radio2
SetAllCheckBox(False)
Case $Button1
Setup1()
Case $Button2
Exit
EndSwitch
WEnd
Func Setup1()
ProgressOn("安装进度", "")
For $i = 0 To UBound($Checkbox1) - 1
$name=stringsplit($Checkbox1[$i][2],"")
ProgressSet(100 / UBound($Checkbox1) * $i, "已完成" & 100 / UBound($Checkbox1) * $i & " % ", "正在安装:" & $name[UBound($name) - 1])
RunWait($Checkbox1[$i][2])
Next
ProgressSet(100, "完成", "完成")
Sleep(500)
ProgressOff()
EndFunc ;==>Setup1