Reputation: 339
I have a list box of values and I want to save the selected value in a variable. I found a lot of things about list box and looked up many functions but didn´t find the way how to get the selected item.
$ListBox = _GUICtrlListBox_Create($GUI2, "1111111-xx1" , 0, 0)
_GUICtrlListBox_AddString($ListBox, "1111111-xx1")
_GUICtrlListBox_AddString($ListBox, "2222222-xx2")
GUISetState() ;show the gui
Local $idMsg = 0
While 1
$idMsg = GUIGetMsg()
Select
Case $idMsg = $btn_copy
;~ here
;~ i need take value from listbox and close gui
;~ after that i start batch file... but important - i need after button click set selected value to variable
Exitloop
EndSelect
WEnd
Upvotes: 0
Views: 443
Reputation: 5609
You need to use GUICtrlRead
to retrieve the selected value of a combobox:
$comboVal = GUICtrlRead($ListBox)
ConsoleWrite("You selected: " & $comboVal & @CRLF)
Upvotes: 1