Antivoyager Posted April 14, 2024 Posted April 14, 2024 I finalized the script for my needs from Andreik, everything is fine, but there is still one task that I cannot cope with and for this I need your help. I need to enable the checkbox (check uncheck all). How can i engage checkbox to check all from list. Can you help me please? expandcollapse popup#RequireAdmin #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <File.au3> #Include <Array.au3> Global $sSourceDir = @ScriptDir Global $sDestinationDir Global $hGUI, $cList, $cAppData, $cCommonFiles, $cExtract Global $aFile = _FileListToArray($sSourceDir, Default, $FLTA_FOLDERS, False) If Not IsArray($aFile) Then Exit $hGUI = GUICreate('MOD1', 330, 365) GUISetBkColor(0x00c6e2ff) GUISetFont(9, 200) $surt = @ScriptDir & "\logo.bmp" $bud = GUICtrlCreatePic($surt,5,5,130,65) $Label = GUICtrlCreateLabel('', 2, 78, 326, 0, $SS_ETCHEDHORZ) $cList = GUICtrlCreateListView("Select the apps you wish to install", 10, 90, 310, 240, $WS_BORDER, $LVS_EX_FULLROWSELECT + $LVS_EX_CHECKBOXES) GUICtrlSetBkColor(-1, 0xfaebd7) GUICtrlSetFont(-1, 9, 300, 1, "Tahoma") GUICtrlCreateGroup(' Select Destination', 140, 5, 185, 65) GUICtrlSetFont(-1, 8, 300, 2, "Tahoma") $cAppData = GUICtrlCreateRadio('Install to Roaming DIR', 148, 25, 170, 20) $cCommonFiles = GUICtrlCreateRadio('Install to CommonFiles DIR', 148, 45, 170, 20) GUICtrlCreateGroup('', -99, -99, 1, 1) $cExtract = GUICtrlCreateButton('Start', 125, 335, 80, 20) $xCheck = GUICtrlCreateCheckbox("Check All", 215, 335, -1, -1) _GUICtrlListView_BeginUpdate($cList) For $Index = 1 To $aFile[0] If StringLeft($aFile[$Index], 1) = '_' Then ContinueLoop GUICtrlCreateListViewItem($aFile[$Index], $cList) Next _GUICtrlListView_EndUpdate($cList) _GUICtrlListView_SetColumnWidth($cList, 0, 292) GUISetState(@SW_SHOW, $hGUI) $FileList =_FileListToArray(@ScriptDir & "\", "*", 2) If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf $HaBudbu = GUICtrlCreateLabel('Found ' & $FileList[0] & ' Folders', 15, 340, -1, -1) GUICtrlSetColor(-1, 0x000000) GUICtrlSetFont(-1, 8, 300, 3, "Tahoma") While True Switch GUIGetMsg() Case $cExtract If GUICtrlRead($cAppData) = $GUI_CHECKED Then $sDestinationDir = @AppDataDir & '\ChessBase\Engines.UCI' If GUICtrlRead($cCommonFiles) = $GUI_CHECKED Then $sDestinationDir = @CommonFilesDir & '\ChessBase\Engines.UCI' If $sDestinationDir Then For $Index = 0 To _GUICtrlListView_GetItemCount($cList) - 1 If _GUICtrlListView_GetItemChecked($cList, $Index) Then SplashTextOn('', 'Installing: ' & _GUICtrlListView_GetItemText($cList, $Index), 330,100,-1,-1,1,"Tahoma", 10, 400) DirCopy($sSourceDir & '\' & _GUICtrlListView_GetItemText($cList, $Index), $sDestinationDir, 1) DirCopy($sSourceDir & "\_x", $sDestinationDir, 1) Sleep(300) ;SplashOff() EndIf Next SplashTextOn('', 'COMPLETED!', 330,100,-1,-1,1,"Tahoma", 10, 400) Sleep(2000) SplashOff() Exit Else SplashTextOn('Error', 'Please select the Destination' & _GUICtrlListView_GetItemText($cList, $Index), 330,100,-1,-1,1,"Tahoma", 10, 400) Sleep(2000) SplashOff() EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
Solution Nine Posted April 14, 2024 Solution Posted April 14, 2024 (edited) Here. You should also consider to toggle check all to uncheck all. Case $xCheck For $i = 0 To _GUICtrlListView_GetItemCount($cList) - 1 _GUICtrlListView_SetItemChecked($cList, $i, GUICtrlRead($xCheck) = $GUI_CHECKED) Next Edited April 14, 2024 by Nine Antivoyager 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Antivoyager Posted April 14, 2024 Author Posted April 14, 2024 9 minutes ago, Nine said: Here. You should also consider to toggle check all to uncheck all. Case $xCheck For $i = 0 To _GUICtrlListView_GetItemCount($cList) - 1 _GUICtrlListView_SetItemChecked($cList, $i, GUICtrlRead($xCheck) = $GUI_CHECKED) Next Yes it works! It was so easy but with my knowlege it's so difficult. Thank you very much
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