Simulate Mouse/Keyboard to stop Screen Saver

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael J Whitmore

    Simulate Mouse/Keyboard to stop Screen Saver

    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(Dire ctory)
    FileList.sort()
    Count = 0
    for FileName in FileList:
    CompleteFileNam e = Directory + FileName
    print "Executing FileName = " +CompleteFileNa me
    os.startfile(Co mpleteFileName)
    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
  • Dave Brueck

    #2
    Re: Simulate Mouse/Keyboard to stop Screen Saver

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

    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


    Comment

    Working...