[python-win32] idle detection on system?

Tim Golden mail at timgolden.me.uk
Tue Sep 23 09:50:19 CEST 2008


Patrick Li wrote:
> Hi,
> Does anyone know how I can detect if a system is idle?  By idle I am
> referring to a user being away from the computer (no keyboard or mouse
> movement) for X minutes.  Tried searching around but I haven't found
> anything that mentions how I can hook into these two events.


I knew there had been some discussion about this in the
past, but my attempts at searching the archives were
frustrated by the huge number of posts about "IDLE"!

In short: you can use the Scheduled Tasks API to trigger
something when the system has been idle for x minutes:

http://mail.python.org/pipermail/python-list/2005-May/323848.html

Alternatively, the GetLastInputInfo API might be what you want:

http://msdn.microsoft.com/en-us/library/ms646302(VS.85).aspx

TJG


More information about the python-win32 mailing list