自动3,将选定值从列表框设置为变量

时间:2015-12-16 10:42:32

标签: variables listbox autoit

我有值列表框,我需要将选定值设置为变量。我发现很多想到ListBox并且看很多功能,但是找不到如何获得所选项目的方法。

$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

1 个答案:

答案 0 :(得分:0)

您需要使用GUICtrlRead来检索组合框的选定值:

$comboVal = GUICtrlRead($ListBox)
ConsoleWrite("You selected: " & $comboVal & @CRLF)