Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Run Perl in Task scheduler to eliminate screensaver

by Anonymous Monk
on Dec 04, 2003 at 07:25 UTC ( [id://312176]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Please advise if there is a script or something in Perl where I can run something every 10 minutes to prevent my screensaver from coming on. I work in a place that automatically turns screensaver on after 15 minutes of inactivity on the Windows NT workstation. I can not change the setting so was hoping to kick off some script to make the screensaver not come on every 15 minutes. Should I just put a Perl script like this:
print "Just run";
and put it in a Task Scheduler? Then a DOS window would pop up every 10 minutes to stop the screensaver? Can I make the DOS pop up window really small and pop up in lower left corner?? Any of this possible??

Replies are listed 'Best First'.
Re: Run Perl in Task scheduler to eliminate screensaver
by castaway (Parson) on Dec 04, 2003 at 07:39 UTC
    As far as I'm aware, the screensaver comes on after X mins of keyboard and mouse inactivity, not computer inactivity, so running a script of any sort like that won't help. You need to simulate keyboard/mouse messages..

    C.

Re: Run Perl in Task scheduler to eliminate screensaver
by Roger (Parson) on Dec 04, 2003 at 07:42 UTC
    I think there is a better solution than poping up a DOS window now and then. Check out the Win32::GuiTest module, which has the handy SendKeys to simulate a keypress. You could have a perl script to first locate the Windows Desktop, and then send a (couple of) shift or ESC keys once in a while. That will stop your screensave from showing up.

      and run it with wincron, a great cron daemon for windows, that doesn't take a brain surgeon to setup -- unlike windows services or taskbar programs.
Re: Run Perl in Task scheduler to eliminate screensaver
by davis (Vicar) on Dec 04, 2003 at 07:45 UTC

    Wouldn't it be easier to make a case for disabling your screensaver? (if you cannot possibly wait for the screen to powerup). Surely if it's that important, your friendly local admin could be convinced to turn it off.


    davis
    It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.
Re: Run Perl in Task scheduler to eliminate screensaver
by matthewb (Curate) on Dec 04, 2003 at 08:09 UTC
    WTF?

    Your sysadmin lets you arbitrarily run any program you have written but not disable the screensaver?

    And how is a DOS prompt popping up every ten minutes less annoying than the screensaver?

    And if you can schedule tasks why not just schedule the prompt to pop-up? Why write a script that implicitly requires a prompt to pop up?

    I had a laugh, cheers. MB
      I laugh at your attitude toward this question! Thanks to everyone else and their direction in helping me with this.
        You really should listen to matthewb and davis.

        I mean, why is it a problem for the screensaver to turn on after 15 minutes of inactivity. It's not your computer, it's the company's. Why do you care if the screensaver turns on if you aren't using the computer? Are you just so full of false laziness that you can't be bothered to type in your password a half-dozen times a day? Maybe someone at the company cares that someone could sit down with your user account and pretend they're you.

Re: Run Perl in Task scheduler to eliminate screensaver
by Ninthwave (Chaplain) on Dec 04, 2003 at 10:24 UTC

    Also try using wperl.exe instead of perl.exe to launch it and you will not get the dos box. That is if you have the ActiveState version of Perl

    Though you would have to write the code to control it, either give it a systray icon or just simply kill it in task manager. But if you do not have screen saver access you probably do not have full task manager access.

    "No matter where you go, there you are." BB
      That is if you have the ActiveState version of Perl
      or any other version of win32 perl (unless you delete it, wperl is there on windows).

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://312176]
Approved by Corion
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.