Dillon Posted December 31, 2014 Posted December 31, 2014 (edited) 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 Edited December 31, 2014 by Dillon
Moderators SmOke_N Posted December 31, 2014 Moderators Posted December 31, 2014 The first parameter of _GUICtrlComboBoxEx_GetItemText is the hwnd (handle to the control you want to interact with). If 1000 is the controlid, then try something like: Local $sText Local $hWnd ControlGetHandle("Window Title or Handle", "", 1000) _GUICtrlComboBoxEx_GetItemText($hWnd, 0, $sText) MsgBox(64, "info", $sText) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
TheDcoder Posted December 31, 2014 Posted December 31, 2014 Are you sure that the controlID is 1000? see the return value of function you are using. A Simple Google search might find you a answer EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
Mat Posted December 31, 2014 Posted December 31, 2014 Also asked on StackOverflow here. I think Smoke_N has it covered though. AutoIt Project Listing
Dillon Posted December 31, 2014 Author Posted December 31, 2014 The first parameter of _GUICtrlComboBoxEx_GetItemText is the hwnd (handle to the control you want to interact with). If 1000 is the controlid, then try something like: Local $sText Local $hWnd ControlGetHandle("Window Title or Handle", "", 1000) _GUICtrlComboBoxEx_GetItemText($hWnd, 0, $sText) MsgBox(64, "info", $sText) I tried this, but I still get nothing in return. My thought is that because there is a button with the same Control ID in the window "ControlGetHandle' is getting the handle for the button and not the Combo Box. I also tried using the Finder Tool in the Auto It Window Info to get the handle for the Combo Box, then plugging that in to the '_GUICtrlComboBoxEx_GetItemText' where you had the hwnd and that returned me nothing as well.
Moderators SmOke_N Posted December 31, 2014 Moderators Posted December 31, 2014 What program are you trying to do this in? It would save days worth of guessing... In the mean time... Make sure you wrap the handle you get from the info tool in the Hwnd() control. eg. _GUICtrlComboBoxEx_GetItemText(Hwnd(0x09394298), etc... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Dillon Posted December 31, 2014 Author Posted December 31, 2014 What program are you trying to do this in? It would save days worth of guessing... In the mean time... Make sure you wrap the handle you get from the info tool in the Hwnd() control. eg. _GUICtrlComboBoxEx_GetItemText(Hwnd(0x09394298), etc... I am trying to do this in RenWeb. I tried the Hwnd () and it returned me a strange character I am unfamiliar with.
Moderators SmOke_N Posted January 1, 2015 Moderators Posted January 1, 2015 You're trying to interact with a website or with an app? I didn't see anywhere to download an app. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Dillon Posted January 2, 2015 Author Posted January 2, 2015 You're trying to interact with a website or with an app? I didn't see anywhere to download an app. RenWeb has online uses but it also has downloadable software which is what I am using. Here is the link to download -----> http://www.renweb.com/Support/Software-Downloads.aspx My guess is however that you won't be able to pull up the window I am seeing because you need to purchase Product key to access.
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