Brethern --

Executing the follow code:

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; }
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,
mdog


In reply to Getting the text from a Win32 Application: Follow Up by mdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.