WinGetText

08/01/2013 00:27 CantShutMyMouth#1
PHP Code:
$t=WinGetText("My Window")
MsgBox(0,"dsa",$) 

That's my "code" .
All works fine, got a msgbox with 35 lines of texts, all from the program.
-But i want only the number 22 line. How do i get it?
-Or maybe, how do i get it with instance( with autoit window info)



SOLVED
08/01/2013 01:02 KDeluxe#2
Code:
$hWnd = WinGetHandle('[CLASS:Notepad]')
$szText = ControlGetText($hWnd, '', 'Edit1')
If $szText <> '' Then
;~     MsgBox(0, '', $szText)
    $aszLines = StringSplit($szText, @CRLF)
;~     For $i = 0 To $aszLines[0]
;~         MsgBox(64, 'Info', 'Line: ' & $i & @CRLF & $aszLines[$i])
;~     Next
    If $aszLines[0] >= 22 Then MsgBox(0, 'Line 22', $aszLines[22])
EndIf
08/01/2013 01:09 CantShutMyMouth#3
Thanks but, as i said, i already solved.
I forgot about the StringSplit function.
08/02/2013 23:37 Achat#4
Quote:
Originally Posted by CantShutMyMouth View Post
All works fine, got a msgbox with 35 lines of texts, all from the program.
-But i want only the number 22 line. How do i get it?
-Or maybe, how do i get it with instance( with autoit window info)
Quote:
Originally Posted by CantShutMyMouth View Post
Thanks but, as i said, i already solved.
I forgot about the StringSplit function.
Sorry, but I could not resist using StringRegExpReplace :o

Code:
MsgBox(0,0,StringRegExpReplace(ControlGetText(WinGetHandle('[CLASS:Notepad]'), '', 'Edit1'),'(?:(.+[\r\n]*){21}(.+)(.+[\r\n]*)+)','\2'))
Quote:
Originally Posted by KDeluxe View Post
Code:
$hWnd = WinGetHandle('[CLASS:Notepad]')
$szText = ControlGetText($hWnd, '', 'Edit1')
If $szText <> '' Then
;~     MsgBox(0, '', $szText)
    $aszLines = StringSplit($szText, @CRLF)
;~     For $i = 0 To $aszLines[0]
;~         MsgBox(64, 'Info', 'Line: ' & $i & @CRLF & $aszLines[$i])
;~     Next
    If $aszLines[0] >= 22 Then MsgBox(0, 'Line 22', $aszLines[22])
EndIf
9 Lines saved ;D

Kind Regards