Jump to content

WinGetText issue


Recommended Posts

What I am attempting to do is , read text in a richtext window from a window not created by autoit . Am I correct in the assumption that WinGetText would be the way to do this ?

$var = WinGetText("[CLASS:RichTextWndClass; INSTANCE:9]", "1")

MsgBox(0, "Text read was:", $var)

Thank you in advance for your help with this .

Link to comment
Share on other sites

  • Moderators

Might try ControlGetText(), the RichEdit is a child of the main window regardless of what application created it.

If that doesn't work, then take a look at some of the _GUICtrlEdit_* functions, the UDF ones can work on other applications as well if you can get the handle of the control (with ControlGetHandle presumably )

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

I think you'll need ControlGetText because [CLASS:RichTextWndClass; INSTANCE:9] is a control-Id.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I am not having a whole lot of luck . Perhaps if i explain what i am trying to do it may help you all to point me in the right direction.

What my intention is to take a single character of text from a rich text window and then depending on the character have autoit press one of four buttons that are located on the same window . I have tried both WinGetText and ControlGetText but have not been able to get either to work for me.

One that looks promising is _GUICtrlEdit_GetText($hWnd) but i am having the error of undefined function when i try to use this .

Link to comment
Share on other sites

Could you please run AutoIt Window Info, point to the control and take screenshots of the Window and Control Tab? A screenshot of the application you want to get the text from could be helpful as well.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hope i managed to get the info you need to be able to help

Both Pics you asked for

What i am trying to do is write something that looks at the data in the answer "E" text box and then from there makes a single leftmouseclik on either Button A B C or D depending on the Data in the "E" text box . Once i get to that point i am then looking to have it delete the data the textbox for "E" then press the first Right Arrow at the bottom of the page so that it moves to the next file . i think i can handle it once i finally get it to be able to read the text . but right now i am just frustrated with my own limited knowledge

once again thank you for your help

Link to comment
Share on other sites

Could you please try:

AutoItSetOption("WinTitleMatchMode",1)
$sText = ControlGetText("Random Test Generator","","[CLASS:RichTextWndClass; INSTANCE:9]")
msgbox(0,"","Text: " & $sText & @CRLF & "Error: " & @error)
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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