Jump to content

Read windows last line of text ?


copyright
 Share

Recommended Posts

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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 ?

Link to comment
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 ?
Link to comment
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.

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