Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: Keep the playback rolling (Win32) (jiggle)

by tye (Sage)
on Mar 10, 2009 at 16:56 UTC ( #749648=note: print w/replies, xml ) Need Help??

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        

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://749648]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2020-07-15 03:10 GMT
Find Nodes?
    Voting Booth?

    No recent polls found