Jump to content

Recommended Posts


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?


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

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...