Jump to content
Sign in to follow this  

Streaming RichEdit Control issues

Recommended Posts



I am using AutoItX to retrieve text from a standard RichEdit streaming text control (similar to an IRC chat window) via ControlGetText. Everything works fine until the number of characters in the control reaches around 35k then AutoItX returns 0 chars even though text is still streaming. I have been unable to figure out how to get around this problem. Any ideas?

I found one solution using a ComboBox control to "reset" the window but AutoItX always returns error 1 no matter what ControlCommand I send to it so it must not be compatible for some reason. I tried using both text string and occurance number but all returned 1.

Any help would be appreciated.


Share this post

Link to post
Share on other sites

I'm having the same problem. I want to monitor a streaming RichEdit control but as soon as it grows larger than a certain size, the function stops returning any text. Does anyone know of a solution? I don't care if I can only get the last 32kb of the text because by monitoring it at regular intervals I can make sure I get everything.

I have discovered one possible workaround as follows:

Get the number of lines in the control:

$lines ControlCommand("Window title", "", ControlID, "GetLineCount", "")

Then loop through all the lines and extract them one at a time with this:

$line = ControlCommand("Window title", "", ControlID, "GetLine", Line#)

However this solution is less than satisfactory because when a line is bigger than the width of the control, it wraps it and GetLine treats them as separate lines, when they are really one. Its important that I get the text in its exact form, not broken up into separate lines.

Edited by sdrawkcab

Share this post

Link to post
Share on other sites

After some experimentation I solved it. Although using the GetLine method does pick up text as separate lines when it has wrapped, any broken lines do not contain a CRLF so its simple to put them back together again in their original form. Here is my code which examines an Edit of arbitrary length one line at a time and then saves the contents to a text file:

; begin code ----------------------------------------------------------------------------------

; Declare variables

Dim $lines

Dim $line

Dim $controlId = 1;

Dim $file = "c:\output.txt"

; Open the file for writing

dim $fileId = FileOpen($file, 1)

; Get the number of lines in the edit

$lines = ControlCommand("Window Title", "", ControlId, "GetLineCount", "")

; Loop through the lines, extract the line text, and write it to the file

For $i = 1 to $lines

$line = ControlCommand("Window Title", "", ControlId, "GetLine", $i)

FileWrite($fileId, $line)


; Close the file


; end code ------------------------------------------------------------------------------------

This script could easily be modified to periodically check the number of lines in the Edit and extract new lines as they appear.

Hope this helps anyone else who needs to get round the 32k limitation of ControlGetText. I suppose this method would fail if any one line in the Edit was larger than 32k but this should be unlikely in a chat room or similar.

Edited by sdrawkcab

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