Orao Posted April 4, 2011 Share Posted April 4, 2011 (edited) Hello,I have found the script below for helping me to choose which programs to install.How can i create a button(or hokey) for "Select ALL/ Select NONE" check-boxes?Here is the script i found:expandcollapse popup#include <Misc.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <TreeViewConstants.au3> _Singleton("Automated Launcher Script") Opt("MustDeclareVars", 1) Opt("GUIOnEventMode", 1) HotKeySet("^!x", "_Close");Exit on Ctrl+Alt+X Global $ininame = "_process_launcher.ini" If $CmdLine[0] == 1 Then $ininame = $CmdLine[1] EndIf If Not FileExists($ininame) Then MsgBox(0x2030, "Error", "No """ & $ininame & """! Writing empty .ini file.") _CreateINI() Exit EndIf Global $slist = IniReadSectionNames($ininame) If @error == 1 Then MsgBox(0x2030, "Error", "Read fail for " & $ininame & "! File empty or invalid.") Exit EndIf Global $guiWindow = GUICreate("Process Queue", 250, 250) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") Global $guiButton = GUICtrlCreateButton("OK", 85, 210, 80, 30, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent($guiButton, "_ButtonEvent") Global $guiLabel = GUICtrlCreateLabel("Choose programs to Install:", 10, 10, 180, 15) Global $guiTree = GUICtrlCreateTreeView(10, 30, 230, 175, $TVS_CHECKBOXES) Global $tItem[$slist[0] + 1] For $i = 1 To $slist[0] $tItem[$i] = GUICtrlCreateTreeViewItem($slist[$i], $guiTree) Next GUISetState(@SW_SHOW) Sleep(86400000) Func _ButtonEvent() Local $msgres = MsgBox(0x2124, "Confirm Selection", "Are you sure of your selection?", 86400, $guiWindow) If $msgres == 6 Then GUISetState(@SW_HIDE) Local $pID, $path, $dir, $checked = False For $i = 1 To $slist[0] If BitAND(GUICtrlRead($tItem[$i]), $GUI_CHECKED) Then $checked = True $path = IniRead($ininame, $slist[$i], "path", "<no path>") $dir = IniRead($ininame, $slist[$i], "dir", ".\") $pID = Run($path, $dir, @SW_HIDE) If @error <> 0 Then MsgBox(0x2030, "Error", "Failed to run " & $slist[$i] & ": """ & $path & """!", 86400, $guiWindow) EndIf ProcessWaitClose($pID) EndIf Next GUISetState(@SW_SHOW) If $checked Then MsgBox(0x2000, "Process Launcher", "Process queue finished!", 86400, $guiWindow) _Close() Else MsgBox(0x2000, "Process Launcher", "No process selected!", 86400, $guiWindow) EndIf EndIf EndFunc Func _CreateINI() Local $file = FileOpen($ininame, 2) FileWriteLine($file, ";INI file for Process Launcher") FileWriteLine($file, ";") FileWriteLine($file, ";INI file format is:") FileWriteLine($file, ";[SECTION]") FileWriteLine($file, ";KEY = VALUE") FileWriteLine($file, ";") FileWriteLine($file, ";Section name is label for installation script.") FileWriteLine($file, ";Key(s) are: Path, Dir") FileWriteLine($file, ";") FileWriteLine($file, ";Processes are launched in succeeding order, one at a time.") FileWriteLine($file, ";") FileWriteLine($file, ";Sample:") FileWriteLine($file, ";[Installer Label 1]") FileWriteLine($file, ";path = someprogram.exe") FileWriteLine($file, ";[Installer Label 2]") FileWriteLine($file, ";path = .\path\someprogram.exe") FileWriteLine($file, ";[Installer Label 3]") FileWriteLine($file, ";path = D:\path\someprogram.exe") FileWriteLine($file, ";dir = D:\path") FileWriteLine($file, ";") FileWriteLine($file, ";Start entries here:") FileClose($file) EndFunc Func _Close() Exit EndFuncThank you Edited April 4, 2011 by Orao Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 4, 2011 Moderators Share Posted April 4, 2011 rao, This should give you the idea: expandcollapse popup#include <Misc.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <TreeViewConstants.au3> Opt("GUIOnEventMode", 1) Global $guiWindow = GUICreate("Process Queue", 250, 250) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") Global $guiButton = GUICtrlCreateButton("OK", 85, 210, 80, 30, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent($guiButton, "_ButtonEvent") Global $ChkButton = GUICtrlCreateButton("Chk All", 5, 210, 80, 30) GUICtrlSetOnEvent($ChkButton, "_ChkEvent") Global $ClrButton = GUICtrlCreateButton("Clr All", 165, 210, 80, 30) GUICtrlSetOnEvent($ClrButton, "_ClrEvent") Global $guiLabel = GUICtrlCreateLabel("Choose programs to Install:", 10, 10, 180, 15) Global $guiTree = GUICtrlCreateTreeView(10, 30, 230, 175, $TVS_CHECKBOXES) Global $tItem[5] For $i = 0 To 4 $tItem[$i] = GUICtrlCreateTreeViewItem($i, $guiTree) Next GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func _ButtonEvent() EndFunc Func _ChkEvent() For $i = 0 To UBound($tItem) - 1 GUICtrlSetState($tItem[$i], $GUI_CHECKED) Next EndFunc Func _ClrEvent() For $i = 0 To UBound($tItem) - 1 GUICtrlSetState($tItem[$i], $GUI_UNCHECKED) Next EndFunc Func _Close() Exit EndFunc M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now