Jump to content

Recommended Posts

Posted

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 window

Following is the code through I'm trying to select the values of Listbox

'To activate window which contains LISTBOX

objAutoIT.WinActivate ("" & strTitle & "1 of 6")

'TO get control ID of Listbox

strControlID = 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 nothing

strtext = objAutoIT.ControlCommand(strHandle, "", strControlID, "FindString", strAggregateName)

'value from variable "strAggregateName" should get selected in Listbox but nothing is happening

strS = objAutoIT.ControlCommand(strHandle, "", strControlID, "SelectString", strAggregateName)

' Although a default value is selected in listbox (when it appears) but below line returns nothing

strT = objAutoIT.ControlListView(strHandle, "", strControlID, "GetSelected", 0, 0)

Please helppost-68880-0-81338200-1348748647_thumb.p

Regards,

NItesh

  • Moderators
Posted

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!

Posted

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.

Posted

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

Posted

@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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...