Getting the text from a Win32 Application

L

loki_mdog

Executing the follow code:

use Win32::GuiTest qw(FindWindowLike GetWindowText GetWindow
SetForegroundWindow SendKeys SendMouse MouseMoveAbsPix
GetDesktopWindow WMGetText GetChildWindows);


my $rhapsodyHandle = GetWindowHandle("Rhapsody");




sub GetWindowHandle{
my($windowName) = @_;
my @windows = FindWindowLike(0, "^$windowName", "");
my $matchingWindow;
for (@windows) {
if($_){
my @children = GetChildWindows($_);
for my $child (@children) {
my $text = GetWindowText($child);
print "Found child $child with text '$text'\n";
}
}
}
return $matchingWindow;
}

Gets me the following text from the win32 music player Rhapsody:
Found child 264196 with text 'track_label.bitmap'
Found child 264198 with text 'album.text'
Found child 264200 with text 'artist.text'
Found child 264202 with text 'song.text'
Found child 198996 with text 'buffering.text'
Found child 198990 with text 'playlist_title.text'
Found child 198992 with text 'info_album.button'

What I am interested in getting is the actual text from song.text,
artist.text, etc so that I can grab that info and do something with it
(mark the song with a keyboard shortcut to say that I like it). The
..text does not refer to actual files but label titles within the
application.

Does anyone have any clue how to get the text from artist.text in the
program rhapsody to output "Alicia Keys" or whatever the current artist
is?

Many, many thanks,
loki_mdog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top