Executing the follow code:
Gets me the following text from the win32 music player Rhapsody:use Win32::GuiTest qw(FindWindowLike GetWindowText GetWindow SetForegroundWindow SendKeys SendMouse MouseMoveAbsPix GetDesktopW +indow 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); next if ($text =~ /^\xff/); # you've found the ico +n next if ($text =~ /^OK|Cancel|Abort|Retry|Ignore|Y +es|No$/); # you've found a button print "Found child $child with text '$text'\n"; } } } return $matchingWindow; }
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,
mdog
In reply to Getting the text from a Win32 Application: Follow Up by mdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |