jo wrote:
Hi

I would like to automatically hibernate my home pc when my wife has not been 
using it for say half an hour.

Two things I dont know

- how to hibernate from python

http://mail.python.org/pipermail/python-win32/2008-June/007698.html

- how to detect idleness of the pc


That's more tricky. You can use GetLastInputInfo
from user32.dll via ctypes. But that only gives you
info about the app which called it (!). You could
try installing a system hook, but that's way too
elaborate and intrusive, I think.

What I suggest is that you simply detect when the
system goes into screen lock of its own accord. You
can use the technique described here, mutatis mutandis:

http://timgolden.me.uk/python/win32_how_do_i/see_if_my_workstation_is_locked.html

and then check additionally for whatever other long-running
processes you want to keep running.

TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to