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
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