Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Getting the text from a Win32 Application

by mdog (Pilgrim)
on Apr 16, 2005 at 00:22 UTC ( [id://448383]=perlquestion: print w/replies, xml ) Need Help??

mdog has asked for the wisdom of the Perl Monks concerning the following question:

Brethern --

Do any of you know how to get all the text (or more than the title) from a windows application?

I can issue the following code but it just gets me the title:

use Win32::GuiTest qw(FindWindowLike GetWindowText SetForegroundWindow SendKeys SendMouse MouseMoveAbsPix GetDesktopWindow); my $rhapsodyHandle = GetWindow("rhapsody"); my $windowText = GetWindowText($rhapsodyHandle); print $windowText . "\n"; sub GetWindow{ my($windowName) = @_; my @windows = FindWindowLike(0, "^$windowName", ""); my $matchingWindow; for (@windows) { if($_){ $matchingWindow = $_; } } return $matchingWindow; }

Many thanks,
mdog

Replies are listed 'Best First'.
Re: Getting the text from a Win32 Application
by FuBaR (Acolyte) on Apr 16, 2005 at 05:30 UTC
    What kind of text are you trying to obtain? There are a lot of different types of applications like dialog based etc. Is it text in the titlebar,on a label, textbox or some sort of document?
    The GetWindowText function copies the text of the specified window’s title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. You might also want to look at the api function GetWindow to enumerate all the child windows.
    You could use GetWindow to enumerate all the sub windows and call GetWindowText to retrieve whatever you find.
    Thats about all the help I can be without knowing more about what you are trying to do.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://448383]
Approved by moot
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found