Jump to content
Sign in to follow this  
sigil

can't get text from listbox

Recommended Posts

sigil

I'm trying to read the entries from a ListBox control that populates after entering some info in an input box and clicking a button in the same window.

But even though I can see entries come up after clicking the button to submit a search, when I check the ListBox contents using the Window Info tool, or using ControlGetText(), no text is found.

Here's what Window Info returns for this control:

ListBox

1

ListBox1

[CLASS:ListBox; INSTANCE:1]

16402

8, 219

1144, 239

124, 34

0x54000909

0x00000200

0x002A060C

Note that the blank space under the control ID (16402) is where the text should be.

Here's the script I'm using to get the text:

$search="Title of Window"

winactivate($search)
winwaitactive($search)
$results=controlgettext($search,"",16402)
msgbox(0,"",$results)

How can I find the text that I see in the ListBox?

Share this post


Link to post
Share on other sites
bo8ster

These can be tough break. Firstly ensure you are getting the correct control handle, using the control ID is a good idea or $search like you are doing.

I can understand why no text is shown, there is no text associated with the control, its in the control, populated at run-time.

Secondly - its a little trail an error - I suggest ControlGetText (i see you have tried) or ControlCommand with different "command" options. You could have a stab using _GUICtrlListBox_GetCurSel($controlHandle) or GUICtrlRead().


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
sigil

These can be tough break. Firstly ensure you are getting the correct control handle, using the control ID is a good idea or $search like you are doing.

I can understand why no text is shown, there is no text associated with the control, its in the control, populated at run-time.

Secondly - its a little trail an error - I suggest ControlGetText (i see you have tried) or ControlCommand with different "command" options. You could have a stab using _GUICtrlListBox_GetCurSel($controlHandle) or GUICtrlRead().

How could I use GUICtrl functions? This isn't an application that I created with an AutoIt script, it's an existing application that I'm trying to interface with.

Share this post


Link to post
Share on other sites
bo8ster

How could I use GUICtrl functions? This isn't an application that I created with an AutoIt script, it's an existing application that I'm trying to interface with.

Like I said, have a stab. I would try it so see what happens probably will not work but it may just. What have you got to lose?

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.