I am attempting to build an Auto It window that will interact with another program window based on user input. However, first I need to display text and information from the outside program on my Auto It window. I am attempting to get text from a Combo Box that is on the outside window and display it on my window. I can not seem to find a function that will successfully retrieve the strings from the Combo Box.
I tried two different functions.
First I tried '_GUICtrlComboBoxEx_GetItemText ()' as show below, but that returned me nothing.
'_GUICtrlComboBoxEx_GetEditText ()' came back blank as well.
Then I tried 'ControlGetText ()'. The problem with that function was that the ID for the Combo Box was identical to another ID for a button in the same window and it was getting the text on the button. Since 'ControlGetText ()' only uses, "title", "text", and ID, I don't see a way to pick out the ComboBox instead of the button.
Below, 'WinActivate ("Window")' is the window that has a Combo Box I am trying to get the String from.
1000 is the ID of the Combo Box in "Window".
#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GUIConstantsEx.au3>
HotKeySet ("{Esc}", "Quit")
Local $mywindow = GUICreate ("Title", 400, 300, -1, -1)
Local $sText
Local $button = GUICtrlCreateButton ("Get Text", 100, 100)
GUISetState (@SW_SHOW, $mywindow)
While 1
Switch GUIGetMsg()
Case $button
WinActivate ("Window") ;program window that has Combo Box
_GUICtrlComboBoxEx_GetItemText (1000, 0, $sText) ;1000 is the Control ID of the Combo Box
MsgBox (0, "Control Text", $sText)
Case -3
Exit
EndSwitch
WEnd