Sign in to follow this  
Followers 0
copyright

Read windows last line of text ?

5 posts in this topic

how would i read the last line of text such as.. (chat window screen) and store that line into a variable !? is this possible ?

Share this post


Link to post
Share on other sites



how would i read the last line of text such as.. (chat window screen) and store that line into a variable !? is this possible ?

<{POST_SNAPBACK}>

Something like this? (untested)

$Wtext = WinGetText("xyz","")
$LastLine = StringTrimLeft($WText,StringInstr($Wtext,@LF,0,-1))

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Maybe it is better...

$Wtext = WinGetText("xyz","")
Select
   Case StringInStr($Wtext,@crlf)
      $S = @crlf
   Case StringInStr($Wtext,@lf)
      $S = @lf
   Case StringInStr($Wtext,@cr)
      $S = @cr
EndSelect

$LastLine = StringTrimLeft($WText,StringInstr($Wtext,$S,0,-1))

...just to be sure that the window uses the @lf.

Or WinGetText always returns @lf ?

Share this post


Link to post
Share on other sites

Maybe it is better...

$Wtext = WinGetText("xyz","")
Select
   Case StringInStr($Wtext,@crlf)
      $S = @crlf
   Case StringInStr($Wtext,@lf)
      $S = @lf
   Case StringInStr($Wtext,@cr)
      $S = @cr
EndSelect

$LastLine = StringTrimLeft($WText,StringInstr($Wtext,$S,0,-1))

...just to be sure that the window uses the @lf.

Or WinGetText always returns @lf ?

<{POST_SNAPBACK}>

i think i got it to work ..but, how would i read the... second to the last line ?

Share this post


Link to post
Share on other sites

hey.. check this:

$Wtext = WinGetText("xyz","")
Select
  Case StringInStr($Wtext,@crlf)
     $S = @crlf
  Case StringInStr($Wtext,@lf)
     $S = @lf
  Case StringInStr($Wtext,@cr)
     $S = @cr
EndSelect

$LastLine = StringTrimLeft($WText,StringInstr($Wtext,$S,0,-1))

it works.. (if i change -1 to -2.. it reads the second to the last line.)

but, heres what i am really getting

start>

chatnick> testing 1..2..3..


<end

problem is there is a return before what i need and 2 returns afterwards.. . how do i just get "chatnick> testing 1..2..3.." ? someone please help.

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