After much trial and error, I came up with this snippet. As always, YMMV.

Create a sample popup window:

# popup.pl use Win32; Popup('testing popup detection...', 16, 'Some popup title'); sub Popup { my ($msg, $flags, $title) = @_; return Win32::MsgBox($msg, $flags, $title); die $msg; }

Find the sample popup window:

# findpopup.pl use Win32::GuiTest qw(:ALL :SW); my @windows = FindWindowLike(0, 'Some popup title'); for my $win (@windows) { print "Found window $win with title '", GetWindowText($win), "'\ +n"; my @children = GetChildWindows($win); for my $child (@children) { my $text = GetWindowText($child); next if ($text =~ /^\xff/); # you've found the icon next if ($text =~ /^OK|Cancel|Abort|Retry|Ignore|Yes|No$/); # +you've found a button print "Found child $child with text '$text'\n"; } }

I ran popup.pl from the desktop and opened a command prompt and ran findpopup.pl from there.

Output:
Found window 4036 with title 'Some popup title'
Found child 1444 with text 'testing popup detection...'


In reply to Re: Win32::GuiTest::GetWindowText does not return text ? by Mr. Muskrat
in thread Win32::GuiTest::GetWindowText does not return text ? by Foggy Bottoms

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.