Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Run Perl in Task scheduler to eliminate screensaver

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

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 Roger (Parson) on Dec 04, 2003 at 12: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 castaway (Parson) on Dec 04, 2003 at 12: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 davis (Vicar) on Dec 04, 2003 at 12: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 13: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
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Run Perl in Task scheduler to eliminate screensaver
by Ninthwave (Chaplain) on Dec 04, 2003 at 15: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 01:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found