Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2019-11-20 14:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (97 votes). Check out past polls.

    Notices?