use Win32::GuiTest qw(FindWindowLike GetWindowText); [...] sub Check_Job { my ($site_num) = @_; my ($buf, $num_windows); my (@windows); $buf = sprintf("^%s - Socks", $site_num); @windows = FindWindowLike(0, $buf); $num_windows = @windows; if ($num_windows == 0) { # NO WINDOWS! Need to resubmit $st = 0; } elsif ($num_windows != 1) { # MULTI-WINDOWS! Oops!! printf("%s: WARNING: There are %d Socks windows for site %d!!!\n", $my_proc, $num_windows, $site_num); $st = 2; } else { # ONE-ONLY WINDOW - GOOD! $st = 1; } return($st); } # end Check_Job