Sign in to follow this  
Followers 0
nitesht

How to select values in LIStBOX

5 posts in this topic

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

Share this post


Link to post
Share on other sites



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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0