Sign in to follow this  
Followers 0
john7a8

Need help reading text from a richedit box - Please

2 posts in this topic

I am new to AutoIt. I have an in-house app and I would like to automate the testing of the app.

There is text in a richedit box that I need to read, but so far have had no success. I have searched the forum and read both FAQs.

Here is what AutoIt Window Info reports:

>>>> Window <<<<

Title: THAAD LRALT Operator Interface Control Panel

Class: #32770

Position: 85, 15

Size: 1110, 960

Style: 0x94CA0045

ExStyle: 0x00050100

Handle: 0x002A064C

>>>> Control <<<<

Class: RICHEDIT

Instance: 9

ClassnameNN: RICHEDIT9

Advanced (Class): [CLASS:RICHEDIT; INSTANCE:9]

ID: 1495

Text:

Position: 100, 296

Size: 120, 30

ControlClick Coords: 64, 14

Style: 0x50020805

ExStyle: 0x00000204

Handle: 0x007C070A

>>>> Mouse <<<<

Position: 167, 359

Cursor ID: 2

Color: 0xFF00FF

I have tried several variations, but so far no success reading the text in the richtedit box. Here are some of the code variations I have tried.

Only the last one ($sText5) returns text. But it the button that controls the text that is displayed in the richtedit box. I only tried this example just to ensure I could read 'any' text from my app. Just to be complete, the textbox will display either the text "ON" or "OFF".

AutoItSetOption("WinTextMatchMode",1)

AutoItSetOption("WinDetectHiddenText",1)

$sText1 = ControlGetText("THAAD LRALT Operator Interface Control Panel","","[CLASS:RichTextWndClass; INSTANCE:9]")

msgbox(0,"","Text1: " & $sText1 & @CRLF & "Error: " & @error)

AutoItSetOption("WinTextMatchMode",1)

AutoItSetOption("WinDetectHiddenText",1)

$sText1a = ControlGetText("THAAD LRALT Operator Interface Control Panel","","[CLASS:RichEditWndClass; INSTANCE:9]")

msgbox(0,"","Text1a: " & $sText1a & @CRLF & "Error: " & @error)

AutoItSetOption("WinTextMatchMode",1)

AutoItSetOption("WinDetectHiddenText",1)

$sText1b = ControlGetText("THAAD LRALT Operator Interface Control Panel","","[CLASS:RICHEDIT; INSTANCE:9]")

msgbox(0,"","Text1b: " & $sText1a & @CRLF & "Error: " & @error)

Sleep ("500")

AutoItSetOption("WinTextMatchMode",1)

AutoItSetOption("WinDetectHiddenText",1)

$sText2 = ControlGetText("THAAD LRALT Operator Interface Control Panel","","[CLASS:32770; INSTANCE:9]")

msgbox(0,"","Text2: " & $sText2 & @CRLF & "Error: " & @error)

Sleep ("500")

AutoItSetOption("WinTextMatchMode",1)

AutoItSetOption("WinDetectHiddenText",1)

$sText2a = ControlGetText("THAAD LRALT Operator Interface Control Panel","","[CLASS:#32770; INSTANCE:9]")

msgbox(0,"","Text2a: " & $sText2a & @CRLF & "Error: " & @error)

Sleep ("500")

AutoItSetOption("WinTextMatchMode",1)

AutoItSetOption("WinDetectHiddenText",1)

$sText3 = ControlGetText("ON","","[CLASS:32770; INSTANCE:9]")

msgbox(0,"","Text3: " & $sText3 & @CRLF & "Error: " & @error)

Sleep ("500")

AutoItSetOption("WinTextMatchMode",1)

AutoItSetOption("WinDetectHiddenText",1)

$sText4 = ControlGetText("ON","","[CLASS:RichTextWndClass; INSTANCE:9]")

msgbox(0,"","Text4: " & $sText4 & @CRLF & "Error: " & @error)

Sleep ("500")

AutoItSetOption("WinTextMatchMode",1)

AutoItSetOption("WinDetectHiddenText",1)

$sText5 = ControlGetText("THAAD LRALT Operator Interface Control Panel","","[CLASS:Button; INSTANCE:17]")

msgbox(0,"","Text5: " & $sText5 & @CRLF & "Error: " & @error)

Any and all suugestions would be greatly appreciated!

John

Share this post


Link to post
Share on other sites



Just a guess, but try using the ID (1495) instead of the class identifier. I have had trouble with the class identifier in the past.

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