Kornel Posted August 13, 2009 Share Posted August 13, 2009 Hi, I need to get all entrys of list box, which function I should use? Link to comment Share on other sites More sharing options...
water Posted August 13, 2009 Share Posted August 13, 2009 (edited) _GUICtrlListView_GetItemCount to get the number of entries and then loop through with _GUICtrlListView_GetItemText. Edited August 13, 2009 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Scriptonize Posted August 13, 2009 Share Posted August 13, 2009 (edited) I've modded an example from the helpfile slightly: expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIListBox.au3> #include <GuiConstantsEx.au3> Opt('MustDeclareVars', 1) Global $myListIDX $Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $sItems, $aItems, $hListBox ; Create GUI GUICreate("List Box Get Sel Items Text", 400, 296) $hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) GUISetState() ; Add strings _GUICtrlListBox_BeginUpdate($hListBox) For $iI = 1 To 9 _GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1))) Next _GUICtrlListBox_EndUpdate($hListBox) ; Select all items..... $myListIDX = 0 For $myListIDX = 0 to _GUICtrlListBox_GetCount($hListBox) _GUICtrlListBox_SetSel($hListBox, $myListIDX) If @error Then ConsoleWriteError(@error & @CRLF) ExitLoop EndIf Next ; Get indexes of selected items $aItems = _GUICtrlListBox_GetSelItemsText($hListBox) For $iI = 1 To $aItems[0] $sItems &= @LF & $aItems[$iI] Next MsgBox(4160, "Information", "Items Selected: " & $sItems) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main [[EDIT:]]You can also use _GUICtrlListBox_SelItemRange to select all items in the listbox Edited August 13, 2009 by Scriptonize If you learn from It, it's not a mistake 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