#! c:/perl/bin $|++; AUTOLOAD; require 5.008; use strict; use Win32; use threads qw[yield]; #let us make threads use threads::shared; # lets share vars between threads use thread::Queue; use POSIX qw [_exit]; use Win32::OLE qw[in with]; use Win32::GuiTest qw (:ALL :SW); use vars qw/%data/; use time::HiRes qw(sleep); my $watcher = threads->create("Watcher"); my $job_done:shared=0; system(); # Do what ever you like here and its popups will be monitored. $job_done = 1; my $error = $watcher->join; sub Watcher { my $watch_error = 0; until ($job_done) { print "I am here\n"; my @windows = FindWindowLike(0,'GO'); for my $win (@windows) { print "Found $win =>". GetWindowText($win). "\n"; my @children = GetChildWindows($win); for my $child (@children) { my $text = GetWindowText($child); next if ($text =~ /^\xff/); if ($text =~ /^OK$/i) { print "FOUND IT ==> Child : $child, Text : $text\n\n"; $watch_error = 1; _exit 0; } } } sleep 1; } return $watch_error; }