nitesht Posted September 27, 2012 Share Posted September 27, 2012 Hi,I'm trying to automate a process using AutoIt. I have written piece of code through which I want to select the values from ListBOX( which comes in popup window). See attached snapshot of windowFollowing is the code through I'm trying to select the values of Listbox'To activate window which contains LISTBOXobjAutoIT.WinActivate ("" & strTitle & "1 of 6")'TO get control ID of ListboxstrControlID = objAutoIT.ControlGetFocus("" & strTitle & "1 of 6")'Above code returns following ID - WindowsForms10.LISTBOX.app.0.2366e6e_r16_ad21'I want find ref/position of string present in variable "strAggregateName", but below line returns nothingstrtext = objAutoIT.ControlCommand(strHandle, "", strControlID, "FindString", strAggregateName)'value from variable "strAggregateName" should get selected in Listbox but nothing is happeningstrS = objAutoIT.ControlCommand(strHandle, "", strControlID, "SelectString", strAggregateName)' Although a default value is selected in listbox (when it appears) but below line returns nothingstrT = objAutoIT.ControlListView(strHandle, "", strControlID, "GetSelected", 0, 0)Please helpRegards,NItesh Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 27, 2012 Moderators Share Posted September 27, 2012 Hi, nitesht. Is this Listbox part of a GUI you've written, or is it from another application? If it is something you have written, you can always use _GUICtrlListView_GetItemTextString to return the text of the item selected. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
clicked Posted September 27, 2012 Share Posted September 27, 2012 There are a number of _GUICtrlListBox commands that you may find helpful. I have used these with success on list box controls in various applications. At first I was confused because it looked like it may only work for controls that AutoIt creates, but you can get the handle for any standard windows control. Link to comment Share on other sites More sharing options...
nitesht Posted September 28, 2012 Author Share Posted September 28, 2012 Hi JLogan3o13,Thanks for you reply.I haven't written "Listbox". It is from another application. I open an application called Spotfire (used for analysis/visulaization) and once its opened the Listbox with tilte "Open Information Link - YA_CRS: Step 1 of 6" appears. Now from this listbox I have to select a value which I'll make as input variable.Pleas let me know solution for this. Beacuse of this issue I'm not able to proceed further.Regards,Nitesh Link to comment Share on other sites More sharing options...
FireFox Posted September 28, 2012 Share Posted September 28, 2012 @nitesht Hi, If you want to read a listbox from another application, it's the same thing : -Get the listbox handle thanks to au3info and ControlGetHandle -Get the text of items with _GUICtrlListBox_ functions Br, FireFox. Link to comment Share on other sites More sharing options...
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