PieMan Posted June 24, 2009 Posted June 24, 2009 In one of our applications there is a drop down box that has about 50 entries... is it possible to extract those entries into a text file? I personally dont think you can but im new to AutoIT so i thought i might ask.. Thanks.
MDCT Posted June 24, 2009 Posted June 24, 2009 (edited) Maybe with _GUICtrlComboBoxEx_GetList?http://www.autoitscript.com/autoit3/docs/l...xEx_GetList.htmGood luck.Here's one example:#include <WinAPI.au3> #include <GUIComboBoxEx.au3> Opt('WinTitleMatchMode', 4) while 1 Sleep(50) if _WinAPI_GetClassName(WinGetHandle("[ACTIVE]")) <> "#32770" Then Sleep(100) Else $Combobox = ControlGetHandle(WinGetHandle("[ACTIVE]"), "", "[CLASS:ComboBox; INSTANCE:1]") tooltip(_GUICtrlComboBoxEx_GetList ($Combobox),0,0) EndIf Sleep(50) WEndIt will show the combobox of Open/Save dialog. So, to try it, you would need to open the dialog, just "save as" on notepad or scite to open the dialog. Edited June 24, 2009 by MDCT
PieMan Posted June 24, 2009 Author Posted June 24, 2009 (edited) Maybe with _GUICtrlComboBoxEx_GetList? http://www.autoitscript.com/autoit3/docs/l...xEx_GetList.htm Good luck. Here's one example: #include <WinAPI.au3> #include <GUIComboBoxEx.au3> Opt('WinTitleMatchMode', 4) while 1 Sleep(50) if _WinAPI_GetClassName(WinGetHandle("[ACTIVE]")) <> "#32770" Then Sleep(100) Else $Combobox = ControlGetHandle(WinGetHandle("[ACTIVE]"), "", "[CLASS:ComboBox; INSTANCE:1]") tooltip(_GUICtrlComboBoxEx_GetList ($Combobox),0,0) EndIf Sleep(50) WEnd It will show the combobox of Open/Save dialog. So, to try it, you would need to open the dialog, just "save as" on notepad or scite to open the dialog. Great thank you so much... its not fully working but at least it's pulling the data from the list (my code). Edited June 24, 2009 by PieMan
MDCT Posted June 25, 2009 Posted June 25, 2009 Hmmm, you're right. It will correctly retrieve all the data in the combobox only after the combobox is drop-downed. Otherwise, it will only retrieve the current item and the items before. I moded the code earlier so it will dropdown the combobox, retrieve the data, and then hide the dropdown. #include <WinAPI.au3> #include <GUIComboBoxEx.au3> Opt('WinTitleMatchMode', 4) while 1 Sleep(50) if _WinAPI_GetClassName(WinGetHandle("[ACTIVE]")) <> "#32770" Then Sleep(100) Else $Combobox = ControlGetHandle(WinGetHandle("[ACTIVE]"), "", "[CLASS:ComboBox; INSTANCE:1]") _GUICtrlComboBoxEx_ShowDropDown($Combobox, True) $list=_GUICtrlComboBoxEx_GetListArray($Combobox) Sleep(25) _GUICtrlComboBoxEx_ShowDropDown($Combobox, False) for $x=1 to $list[0] tooltip("Total data: "&$list[0] &" Current data: "&$list[$x],0,0) sleep(200) next EndIf Sleep(50) WEnd I know the work around is not pretty, but I believe the experts here could help you to get all the data better than this. Good luck.
Thamiel Posted June 26, 2009 Posted June 26, 2009 Here's a snippet from a program I've been working on, the Function delete's an entry from a ComboBox, after which it delete's the old ini file, then sorts the ComboBox entries, removes any dupes and lastly writes the remaining ComboBox entries back out to an ini file. Func Del() _GUICtrlComboBox_DeleteString($PickIt, _GUICtrlComboBox_FindStringExact($PickIt, ControlGetText('', '', '[CLASS:Edit; INSTANCE:2]'), -1)) If FileExists($ST_INI) Then FileDelete($ST_INI) $aList = _GUICtrlComboBox_GetListArray($PickIt) _ArraySort($aList) _ArrayRemoveDuplicates($aList) $file = FileOpen($ST_INI, 1) For $x = 1 To $aList[0] FileWriteLine($file, $aList[$x]) Next FileClose($file) EndFunc ;==>Del
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