[python-win32] Windows "idle" time & killing a process
Tim Golden
mail at timgolden.me.uk
Fri Dec 11 15:28:07 CET 2009
Randy Syring wrote:
> I use synergy to connect the keyboard and mouse on my desktop to my
> laptop. However, I have found that synergy keeps my monitors from
> shutting off when it is running. I often forget to turn synergy off at
> the end of the day, which means my monitors waste energy and bulb life.
>
> I would like to write a script in Python that would check if the
> computer had been idle (i.e. no user input) for > 1 hour and if so, shut
> down synergy if it is running. I would appreciate pointers in two areas:
>
> * How would I check how long the computer had been idle
> * How would I kill a process if I only know the name
>
> Brief references would be fine, I am happy to go digging.
Might I recommend these two search URLs?
(you'll have to ignore the references to IDLE,
the Python development env)
site:mail.python.org windows idle python-win32
site:mail.python.org windows kill python-win32
plus, possibly, this example (which isn't quite what you're
after but which does at least have some of the pieces you
might need):
http://timgolden.me.uk/python/win32_how_do_i/find-the-window-for-my-subprocess.html
TJG
More information about the python-win32
mailing list