#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: myName Script Function: Template AutoIt script. List #ce ---------------------------------------------------------------------------- #include #include #include $t = TimerInit() $aList = IniReadSection("Example.ini", "List") ConsoleWrite("- Load INI Time " & TimerDiff($t) & @CRLF) $hWnd = GUICreate("Save Setup Example", 726, 434, 188, 227) $hLV = GUICtrlCreateListView("", 8, 8, 513, 377) _GUICtrlListView_SetExtendedListViewStyle($hLV, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) GUICtrlCreateLabel("Search", 16, 400, 38, 17) $hSearch = GUICtrlCreateInput("Search", 64, 400, 225, 21) GUICtrlCreateLabel("Scenario", 528, 8, 50, 17) $hSetup = GUICtrlCreateList("", 528, 32, 187, 110) GUICtrlSendMsg($hSetup, $LB_INSERTSTRING, 0, "Select All") ; Set Default data GUICtrlSendMsg($hSetup, $LB_INSERTSTRING, 1, "Clear All") ; Set Default data GUICtrlSendMsg($hSetup, $LB_INSERTSTRING, 2, "My Scenario") GUICtrlSendMsg($hSetup, $LB_INSERTSTRING, 3, "Scenario Test 2") GUICtrlSendMsg($hSetup, $LB_INSERTSTRING, 4, "Test 3") GUICtrlSendMsg($hSetup, $LB_SELECTSTRING, -1, "Clear All") ; Select in Config $hSetupSave = GUICtrlCreateButton("Save Scenario", 528, 152, 91, 25) $hSetupDel = GUICtrlCreateButton("Delete Scenario", 624, 152, 91, 25) $Debug1 = GUICtrlCreateButton("Select Rng", 528, 312, 91, 25) $Debug2 = GUICtrlCreateButton("Debug", 624, 312, 91, 25) $Label3 = GUICtrlCreateLabel("Label3", 528, 344, 36, 17) ; Add columns _GUICtrlListView_AddColumn($hLV, "#", 45) _GUICtrlListView_AddColumn($hLV, "Group", 100) _GUICtrlListView_AddColumn($hLV, "Test Name", 300) _GUICtrlListView_AddColumn($hLV, "Status", 60) $t = TimerInit() _GUICtrlListView_BeginUpdate($hLV) $NumLen = StringLen($aList[0][0]) For $i = 1 To $aList[0][0] _GUICtrlListView_AddItem($hLV, StringFormat("%0" & $NumLen & "i", $i)) $aStr = StringSplit($aList[$i][0], "__", 1) _GUICtrlListView_AddSubItem($hLV, $i-1, StringReplace($aStr[1], "_", " "), 1) _GUICtrlListView_AddSubItem($hLV, $i-1, StringReplace($aStr[2], "_", " "), 2) ; GUICtrlCreateListViewItem("Item " & $i, $idListview) Next _GUICtrlListView_EndUpdate($hLV) ConsoleWrite("- Load LV Time " & TimerDiff($t) & @CRLF) GUISetState(@SW_SHOW) $iI = -1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hSetup Switch GUICtrlRead($hSetup) Case "Select All" For $i = 0 To _GUICtrlListView_GetItemCount($hLV) _GUICtrlListView_SetItemChecked($hLV, $i, True) Next Case "Clear All" For $i = 0 To _GUICtrlListView_GetItemCount($hLV) _GUICtrlListView_SetItemChecked($hLV, $i, False) Next EndSwitch Case $hSetupSave Case $hSetupDel Case $Debug1 $iI = Random(0, 10, 1) _GUICtrlListView_SetItemSelected($hLV, $iI) _GUICtrlListView_SetItemFocused($hLV, $iI) _GUICtrlListView_EnsureVisible($hLV, $iI + 1) EndSwitch WEnd