#!/usr/bin/perl -w use strict; use Win32::GuiTest qw< GetCursorPos MouseMoveAbsPix >; my( $x, $y )= GetCursorPos(); my $toggle = 1; while( sleep 5 ) { my( $x1, $y1 )= GetCursorPos(); exit unless $x1 or $y1; ( $x, $y ) = ( $x1, $y1 ), next unless $x == $x1 && $y == $y1; $x = $x1 + $toggle; $y = $y1 + $toggle; $toggle *= -1; MouseMoveAbsPix( $x, $y ); }