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.