Sign in to follow this  
Followers 0
Moon

Can't get text from Window

6 posts in this topic

I have a window that lets me search a database, in the lower left corner it says:

23.245 entries 50 marked

I wanna get the 23.245 as text. How do I do it if Auinfo does not give any text when I hover over this entry?

TIA!

Share this post


Link to post
Share on other sites



I have a window that lets me search a database, in the lower left corner it says:

23.245 entries 50 marked

I wanna get the 23.245 as text. How do I do it if Auinfo does not give any text when I hover over this entry?

TIA!

Try this script and see if it finds the control with that text.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

It looks good but it does not seem to work properly, maybe cause I', on AutoIt 3.2? I can grab info from the window but the listed items do not contain the "number of entries" I'm looking for. So I tried to copy all to the clipboard to see whether I can get the info from this. Doing so I get the error message:

Error in line 327

Subscript used with non-Array variable.

This happens whether I try to copy all or just some items.

EDIT: I was blind again, the info is there, it reads:

'&Direct Hits (854)'

whereas '854' is the number I'm interested in.

Now when I press the (+) on it I get: TcxTabSheet2

So this is the control handle I gotta read from to get the value '854'? Like

$var = ControlGetText("My Window", "", "TcxTabSheet2")

Sorry, I'm still a bit confused about all of this...

Edited by Moon

Share this post


Link to post
Share on other sites

Now when I press the (+) on it I get: TcxTabSheet2

So this is the control handle I gotta read from to get the value '854'? Like

$var = ControlGetText("My Window", "", "TcxTabSheet2")

Yes that looks right.

Share this post


Link to post
Share on other sites

Oops, I should have been more specific. I DID use

$var = ControlGetText("My Window", "", "TcxTabSheet2")

but all it returned was "" and not '854'. So what did I do wrong?

Share this post


Link to post
Share on other sites

OK, so I've fiddled around with it a bit and used a different window which also displays info from the database but in a more specific way. Using Au3info I've identified the Control ID I'm interested in:

Control ID: 66098

ClassNameNN: TdxStatusBar1

Text:

As you can see the Text field is empty even though the control has the text '854 Entries'.

Thus when I use $num_entries = ControlGetText("My Window", "", 66098) it returns an empty string. Curiously enough this text IS retrievable with the function WinGetText and shown in Au3Info under >>>> Visible Window Text <<<< like this:

Toolbar

&command1

&command2

&command3

on (U)

on (U)

&filter1

category

&direct hits (854)

more hits

sorted by

sorted by

So how can I convert this string returned by WinGetText to '854' (the number may be smaller/larger but it'll always be in brackets), which is all I'm interested in?

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