Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 16:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



WinGetText

Discussion on WinGetText within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
CantShutMyMouth's Avatar
 
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
CantShutMyMouth is offline  
Old 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
KDeluxe is offline  
Thanks
1 User
Old 08/01/2013, 01:09   #3
 
CantShutMyMouth's Avatar
 
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.
CantShutMyMouth is offline  
Old 08/02/2013, 23:37   #4
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
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

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
Achat is offline  
Reply




All times are GMT +1. The time now is 16:24.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.