Simulate Mouse/Keyboard to stop Screen Saver

Dave Brueck dave at pythonapocrypha.com
Thu Nov 6 19:47:40 CET 2003


> 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






More information about the Python-list mailing list