Jump to content

ControlGetText returning "" in a non-empty window


Recommended Posts

I'm working within VB, because I have already created so much code to run my equipment and do other stuff. I have a question concerning the proper use (and my apparent misuse) of ControlGetText, via the DLL.

In the hours since I've begun working with AutoIt, I've been able to accomplish a lot. I'm impressed with this tool. I'm getting data on optical media in my lab much more easily than before I pressed AutoIt into service as an imported feature to my VB programs.

In this instance, I've already got a way to get a targeted, slave application to save data, which I can then parse in one of many usual fashions in VB. That's what I'm doing now, and it works just fine...though it seems kind of circuitous, even Rube Goldbergish,to have to save data I can see right on the screen, in order to go read it back.

:)

I would like to know if I can get around the need to save the data into a text file, since it's already visible on the screen before it is saved. It will clean-up and speed-up my process to just get it off the screen, which I understand is trivial for AutoIt.

Using the "Window Info" tool, I am able to isolate the box containing the text I want to parse. The report from the "Window Info" utility is as follows:

>>>> Window <<<<

Title: ADIPError - ADIP Error Check Program

Class: Afx:400000:b:10011:6:a9502f5

Position: 22, 25

Size: 982, 619

Style: 0x14CFC000

ExStyle: 0x00000100

Handle: 0x00220464

>>>> Control <<<<

Class: AfxWnd42s

Instance: 2

ClassnameNN: AfxWnd42s2

Advanced (Class): [CLASS:AfxWnd42s; INSTANCE:2]

ID: 1

Text:

Position: 2, 63

Size: 953, 482

ControlClick Coords: 851, 278

Style: 0x56000000

ExStyle: 0x00000000

Handle: 0x002704F6

>>>> Mouse <<<<

Position: 879, 416

Cursor ID: 2

Color: 0xFFFFFF

>>>> StatusBar <<<<

1: Ready

2: Oct,03,2009 05:58:31 PM

3:

4: NUM

5:

>>>> Visible Text <<<<

Ready

Start(&S)

>>>> Hidden Text <<<<

Unfortunately, my attempts to do a ControlGetText on the region of the screen containing the data I want have met with a "" being returned. So, I'm probably getting it wrong. The line from my VB code looks like this:

ReportText = cAutoIt.ControlGetText("ADIPError - ADIP Error Check Program", "", 1)

So, either this is wrong, or there's something else going on. Notably, the stuff reported under "Visible Text" in the "Window Info" tool is not what I see on the screen at all. There are several columns of data there (the stuff I'm currently having the application save to file for parsing). I'm kinda stumped.

So, how else might I go about getting the text off the screen? Is ControlGetText the right channel? Or must I do something else? Please know, I've been combing the helps and forums for quite a while, before posting my question. Your expertise is my hope, after the failure of my resourcefulness.

:)

By the way, that second argument in the ControlGetText call makes no sense to me. I mean, if I know the text I'm trying to get already, under what circumstances would I need to go "get" it in the first place? Curious.

GlyphMaker,

I had a similar question to the one that you had asked regarding using the ControlGetText function. I am curious as to what work-around you currently have regarding this? You had mentioned that you have a way of grabbing this text and sending it to a text file to be used by your VB program. I think that I would have a use for this type of functionality. If you don't mind, would you be able to show me the code that you have utilized to perform this?

Thank you.

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