|
You last visited: Today at 16:23
Advertisement
WinGetText
Discussion on WinGetText within the AutoIt forum part of the Coders Den category.
08/01/2013, 00:27
|
#1
|
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
|
WinGetText
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
|
#2
|
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,149
|
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
|
#3
|
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
|
Thanks but, as i said, i already solved.
I forgot about the StringSplit function.
|
|
|
08/02/2013, 23:37
|
#4
|
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
|
Quote:
Originally Posted by CantShutMyMouth
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
Thanks but, as i said, i already solved.
I forgot about the StringSplit function.
|
Sorry, but I could not resist using StringRegExpReplace
Code:
MsgBox(0,0,StringRegExpReplace(ControlGetText(WinGetHandle('[CLASS:Notepad]'), '', 'Edit1'),'(?:(.+[\r\n]*){21}(.+)(.+[\r\n]*)+)','\2'))
Quote:
Originally Posted by KDeluxe
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
|
|
|
All times are GMT +1. The time now is 16:24.
|
|