in reply to Re: Keep the playback rolling (Win32)
in thread Keep the playback rolling (Win32)

It might be because your optical mouse decided to jiggle the pointer one pixel? You could certainly add a tolerance for how much the mouse pointer needs to move to terminate it or remove that check entirely and just Ctrl-C the script when you want it to stop. This sensitive test is fine for my particular use case. Note that it also fails if the mouse pointer is too close to the wrong screen edge.

This pl2bat-wrapped version avoids both such problems:

@rem = '--*-Perl-*-- @echo off if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have Perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto endofperl @rem '; #!perl -w #line 15 use strict; use Win32::GuiTest qw< GetCursorPos MouseMoveAbsPix >; sleep 5; my( $x, $y )= GetCursorPos(); my @dx= ( 10, -10, -10, 10 ); my @dy= ( 10, 10, -10, -10 ); while( 1 ) { sleep 1; my( $x1, $y1 )= GetCursorPos(); exit if( 10 < abs( $x - $x1 ) || 10 < abs( $y - $y1 ) ); $x += $dx[0]; push @dx, shift @dx; $y += $dy[0]; push @dy, shift @dy; MouseMoveAbsPix( $x, $y ); } __END__ :endofperl

- tye