Jump to content

Getcontroltext with ClassNN or coords


Recommended Posts

With help from Malkey I was able to read text from a button with controlGetText($MAIN_WINDOW_TITLE, "", "[X:7\;Y:2\]")

But now I've stumbled upon a new problem.

Although the code works for reading text from the toolbar in the application I use it does not read statics or editbox's.

But using: ControlGetText($MAIN_WINDOW_TITLE, "", "Static1") does give me the result.

Whereas using it with the coordinates of this static I don't get a result.

I first thought it had to to with the application because the window is AcucobolWClass, but since I do get a result with calling Static1 I'm not so sure.

My guess its a bug...can anyone confirm or deny that?

Link to comment
Share on other sites

  • Moderators

With help from Malkey I was able to read text from a button with controlGetText($MAIN_WINDOW_TITLE, "", "[X:7\;Y:2\]")

But now I've stumbled upon a new problem.

Although the code works for reading text from the toolbar in the application I use it does not read statics or editbox's.

But using: ControlGetText($MAIN_WINDOW_TITLE, "", "Static1") does give me the result.

Whereas using it with the coordinates of this static I don't get a result.

I first thought it had to to with the application because the window is AcucobolWClass, but since I do get a result with calling Static1 I'm not so sure.

My guess its a bug...can anyone confirm or deny that?

We can confirm or deny it with the right information. Without knowing the application itself, and the inability of testing for ourselves, the only option you'll have is an educated guess.

Guess 1:

The Edit and Static controls are owner drawn, so they are not "Standard" MS controls.

Guess 2:

Based on the class name, if the data is in Unicode, you could have an issue there as well.

Now, just because these are guesses, don't assume you can find a solution by asking how you would test it to be sure. That just leads to more guessing, be a bit smarter and provide the application name for others to test for themselves.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Static control? What kind of control is that? Does it even have a text? :)

A label would be an example of a static control.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

It turns out its not a bug....well not exactly anyway.

When I use the InfoTool, it gives me a position of a control (the correct position compared to an older autoIt version).

Because I couldn't find any controls on my previously programmed location I made a small testscript:

Dim $Array1[50][50]
For $X=1 to 49 ;x
    for $Y= 1 to 49 ;y
        $array1[$X][$Y]= ControlGetText("ANVA Test", "","[X:" & $X+150 & ";Y:" & $Y+300 & "]")
    next
next
_ArrayDisplay($array1)

With this I scanned an area of the screen (application). This gave me the result I wanted but there's a 27 difference in what the Infotools shows and my testscript.

So I can get it to work, but I ca'nt explain the difference in coordinates.

Edited by IQ9003
Link to comment
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
 Share

  • Recently Browsing   0 members

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