in reply to Win32::GuiTest::GetWindowText does not return text ?
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...'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Win32::GuiTest::GetWindowText does not return text ?
by Foggy Bottoms (Monk) on Aug 12, 2003 at 07:56 UTC |