Simulate Mouse/Keyboard to stop Screen Saver

  • Thread starter Michael J Whitmore
  • Start date
M

Michael J Whitmore

Greetings,

I have a very simple question. How do you simulate a user input to
turn off a screen saver in Windows (either a mouse movement, mouse
click, or keyboard input)? I promise I searched the newsgroup before
asking :)

I have written the following program that loads all my Webshots files
into the Webshots photo manager, or so I thought. When you load the
first it starts the screen saver. All other subsequent ones are not
loaded into the system, unless you sit there and move the mouse. This
stops the screen saver and when the sleep stops the next one is
started.

import os
import re
import time
Directory = "d:/download/webshots/2003-08/"
FileList = os.listdir(Directory)
FileList.sort()
Count = 0
for FileName in FileList:
CompleteFileName = Directory + FileName
print "Executing FileName = " +CompleteFileName
os.startfile(CompleteFileName)
Count = Count + 1
time.sleep(5)
print str(Count)+ " files executed"

Since I have approximately 2 photos a day from 1998 on I really don't
want to do this manually.

Thank you
 
D

Dave Brueck

I have a very simple question. How do you simulate a user input to
turn off a screen saver in Windows (either a mouse movement, mouse
click, or keyboard input)? I promise I searched the newsgroup before
asking :)

Maybe somebody will know the answer, but in the meantime you can be
searching on how to do this from C or VisualBasic - IOW you can be searching
MSDN or some other Windows-specific resource. Once you know how to do it
from one of those languages it'll be trivial to do it from Python. I guess
I'm saying that, since it's such a Windows-specific question, you might want
to make sure your search is broader than Python users who have done the same
thing in the past - which is what you get by polling c.l.py.

FWIW I seem to remember some Windows API for disabling the screensaver
altogether (as in, turn off the show-screensaver-after-so-many-minutes
functionality), so you could call that at the beginning of your processing
and then turn it back on at the end. This would probably work better than
simulating mouse/keyboard input.

Good luck!
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top