#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
$Form1 = Guicreate("Client PC 自動化安裝程式", 340, 125, -1, -1)
$Button1 = GuiCtrlCreateButton("全選", 10, 95, 60, 20)
$Button2 = GuiCtrlCreateButton("取消全選", 130, 95, 60, 20)
$Button3 = GuiCtrlCreateButton("執行", 250, 95, 60, 20)
$Checkbox1 = GUICtrlCreateCheckbox("Office2003", 10, 10, 120, 20)
$Checkbox2 = GUICtrlCreateCheckbox("還原軟件", 10, 40, 120, 20)
$Checkbox3 = GUICtrlCreateCheckbox("AdbeRdr810", 10, 70, 120, 20)
$Checkbox4 = GUICtrlCreateCheckbox("Java", 130, 10, 120, 20)
$Checkbox5 = GUICtrlCreateCheckbox("7-Zip", 130, 40, 120, 20)
$Checkbox6 = GUICtrlCreateCheckbox("ERP", 130, 70, 120, 20)
$Checkbox7 = GUICtrlCreateCheckbox("VNC監視器", 250, 10, 120, 20)
$Checkbox8 = GUICtrlCreateCheckbox("Xn View", 250, 40, 120, 20)
$Checkbox9 = GUICtrlCreateCheckbox("IE7", 250, 70, 120, 20)
GuiSetState(@SW_SHOW)
HotKeySet("{ESC}", "_Exit") ;按Esc結束程式
Func _Exit()
Exit 0
EndFunc
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1 ;設定Checkbox 1~11 全選
GUICtrlSetState($Checkbox1,$GUI_CHECKED)
GUICtrlSetState($Checkbox2,$GUI_CHECKED)
GUICtrlSetState($Checkbox3,$GUI_CHECKED)
GUICtrlSetState($Checkbox4,$GUI_CHECKED)
GUICtrlSetState($Checkbox5,$GUI_CHECKED)
GUICtrlSetState($Checkbox6,$GUI_CHECKED)
GUICtrlSetState($Checkbox7,$GUI_CHECKED)
GUICtrlSetState($Checkbox8,$GUI_CHECKED)
GUICtrlSetState($Checkbox9,$GUI_CHECKED)
Case $Button2 ;設定Checkbox 1~11 取消全選
GUICtrlSetState($Checkbox1,$GUI_UNCHECKED)
GUICtrlSetState($Checkbox2,$GUI_UNCHECKED)
GUICtrlSetState($Checkbox3,$GUI_UNCHECKED)
GUICtrlSetState($Checkbox4,$GUI_UNCHECKED)
GUICtrlSetState($Checkbox5,$GUI_UNCHECKED)
GUICtrlSetState($Checkbox6,$GUI_UNCHECKED)
GUICtrlSetState($Checkbox7,$GUI_UNCHECKED)
GUICtrlSetState($Checkbox8,$GUI_UNCHECKED)
GUICtrlSetState($Checkbox9,$GUI_UNCHECKED)
Case $Button3
If BitAND(GUICtrlRead($Checkbox1),$gui_checked) Then
RunWait("各軟體Auto\5.安裝Office2003.exe",@ScriptDir)
EndIf
If BitAND(GUICtrlRead($Checkbox2),$gui_checked) Then
RunWait("各軟體Auto\2.安裝還原軟件.exe",@ScriptDir)
EndIf
If BitAND(GUICtrlRead($Checkbox3),$gui_checked) Then
RunWait("各軟體Auto\3.安裝AdbeRdr810.exe",@ScriptDir)
EndIf
If BitAND(GUICtrlRead($Checkbox4),$gui_checked) Then
RunWait("各軟體Auto\4.安裝Java.exe",@ScriptDir)
EndIf
If BitAND(GUICtrlRead($Checkbox5),$gui_checked) Then
RunWait("各軟體Auto\1.安裝7-Zip.exe",@ScriptDir)
EndIf
If BitAND(GUICtrlRead($Checkbox6),$gui_checked) Then
RunWait("各軟體Auto\6.安裝ERP.exe",@ScriptDir)
EndIf
If BitAND(GUICtrlRead($Checkbox7),$gui_checked) Then
RunWait("各軟體Auto\7.安裝VNC監視器.exe",@ScriptDir)
EndIf
If BitAND(GUICtrlRead($Checkbox8),$gui_checked) Then
RunWait("各軟體Auto\8.安裝Xn View.exe",@ScriptDir)
EndIf
If BitAND(GUICtrlRead($Checkbox9),$gui_checked) Then
RunWait("各軟體Auto\9.安裝IE7.exe",@ScriptDir)
EndIf
MsgBox(0,"Auto Install Script","Auto Client Install 自動安裝、設定完畢" &@LF& " 請立即重新開機完成安裝程序")
EndSwitch
Wend