Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Keep the playback rolling (Win32)

by BrowserUk (Pope)
on Apr 03, 2009 at 06:00 UTC ( #755180=note: print w/replies, xml ) Need Help??

in reply to Keep the playback rolling (Win32)

A variation on your theme, I for the first time had a use for this--watching F1 practice sessions via the web and my screen saver kept kicking in. As I can't use Win32::API, I grabbed your code.

There were a couple of things that bugged me. I found the diamond pattern a little distracting. And if I used the mouse to adjust the volume or dismiss an email notification, the loop terminated and I had to switch away to restart it.

So I reduced the movement to a simple +1/-1 giggle at a reduced frequency and made it so that it wouldn't quit the loop until I moved the mouse to the top left corner.

#!/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 ); }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Keep the playback rolling (0 offset)
by tye (Sage) on Apr 03, 2009 at 06:47 UTC

    FYI, based on another reply, you don't need to even move the pointer at all. But I haven't tested that (and one might want the subtle movement to remind one that the screen-saver-thwarting is still in effect, in case one wants their screen saved). Thanks for the updated version.

    - tye        

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2020-08-07 01:10 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (43 votes). Check out past polls.