sub StartErrorGuardian { my ($this, $pm) = @_; $this->Log("INFO","CWAPP: Starting error guardian\n"); $continue_flag = 1; if ($this->{bThreadStarted} == 0) { $this->{bThreadStarted} = 1; my $pid= fork(); if (not defined $pid) { $this->Log("ERROR","CWAPP: Could not start error guardian\n"); return 0; } if ($pid == 0) { $this->Guardian(); } else { return $pid; } } return 0; } #### sub Guardian { my ($this) = @_; my $i = 0; while (1) { {#find any message-box with class #32770 [usually infos and errors] and press it's child OK button @err_window = FindWindowLike(undef, "", "#32770"); foreach (@err_window) { SetForegroundWindow($_); SetActiveWindow($_); PushChildButton( $err_window[$i], "OK", 0.25 ); PushChildButton( $err_window[$i], "Abort", 0.25 ); } sleep 1; } }