Sign in to follow this  
Followers 0
sonne17111

WinHetText() Problem

4 posts in this topic

Hi!

Maybe someone can help me on this topic. I want to get only new text from the WinGetText. How can I do this?

It means at the first call of wingettext I get a text. Then later I do again wingettext and this time I only need the new text and not all the text again.

Anyone see a solution?

Thank!

Share this post


Link to post
Share on other sites



If text always appends at end you can keep copy of full previous text in the string (or it's length) and then StringTrimLeft it (pseudocode, I don't know what exactly you need):

$text_prev = ""
While ...
  $text_cur = WinGetText(...)
  $text_new = StringTrimLeft($text_cur, StringLen($text_prev))
  $text_prev = $text_cur
Wend

Share this post


Link to post
Share on other sites

If text always appends at end you can keep copy of full previous text in the string (or it's length) and then StringTrimLeft it (pseudocode, I don't know what exactly you need):

Share this post


Link to post
Share on other sites

Additional problem is this:

The text I get is something like a log. It means all the time new text arrive at the end. And I want to get all this text line by line. So I can do this with the code above.

WinGetText take all text, so if you need lines, you have split text by @CR or @LF.

But what if after sometime the begin lines of the text removed? Any solution for this too??

Hm, maybe need to add size check: if current text length is less then previous, you can assume that log was reset, so in this case you need empty $text_prev.

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