Clicking on the same button again and again and again (you get the picture) until that bonus game is triggered?
Not me! Not with Win32::GuiTest in the toolbox.
#!/usr/bin/perl -w use strict; use Win32::GuiTest qw/ GetWindowText GetForegroundWindow SendMouse GetWindowRect ScreenToNorm /;
my ($titleWindow, $leftClick, $topClick) = @ARGV; $titleWindow ||= "My App"; $leftClick ||= 750; $topClick ||= 600;
while(1) { sleep(1); my $hwindTop = GetForegroundWindow() or next; GetWindowText($hwindTop) =~ /\Q$titleWindow\E/ or warn("Window ($titleWindow) not active\n"), next;
my ($left, $top) = GetWindowRect($hwindTop); $left += $leftClick; $top += $topClick; warn("Clicking on ($titleWindow) at $left, $top\n");
($left, $top) = ScreenToNorm($left, $top); SendMouse("{ABS$left,$top}{LEFTCLICK}"); }
__END__