My company laptop has some remnants from the previous IT regime's mindset (one that is all too common) and so I'm not allowed to adjust how quickly the screen-saver / desktop-locker kicks in.

I have shows that get recorded for me but that I rarely have the time to sit down and watch. So I transfer them to my work laptop and watch them (mostly just listen to them, actually) during my bus commute.

I finally got a really nice biking backpack I've wanted so now I can even listen to them when I commute by bicycle and I even have a little program to cue up cuts to skip over the commercials for me.

The first day that I tried that, playback stopped about half-way to the office. I stopped and checked the laptop and the screensaver had kicked in. At work I googled and got the suggestion that I run Windows Media Player with its volume turned down while it was configured to prevent screen-saver activation. The ride home demonstrated that this is not sufficient to prevent administratively mandated screen-saver timeouts.

More googling at home mostly found people noting that when one doesn't have administrative rights, one can't install a program to thwart the screen-saver activation anyway so no such programs are offered.

So I wrote the following Perl program:

#!/usr/bin/perl -w 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( $x != $x1 || $y != $y1 ); $x += $dx[0]; push @dx, shift @dx; $y += $dy[0]; push @dy, shift @dy; MouseMoveAbsPix( $x, $y ); }

It just waits five seconds and then makes the mouse pointer move around in a nice little diamond pattern until you bump your mouse.

This morning's bike commute I enjoyed the audio from uninterrupted video playback. Thanks, Perl.

- tye        


In reply to Keep the playback rolling (Win32) by tye

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.