Jump to content

idle time out


Recommended Posts

I try to detect if a computer is idle (no mouse activity) but it dosen't seem to work. Can somebody help me ? Thanks.

;code-------------------------------------------------------------

While isIdleTimeOut(1000,60) = 0

MsgBox(0,"test","idle time out.",5)

Sleep(1000*20)

WEnd

Func isIdleTimeOut($timeSlice,$idleCountLimit)

$idleCount = 0

While $idleCount <= $idleCountLimit

$mousePos1 = MouseGetPos()

Sleep($timeSlice)

$mousePos2 = MouseGetPos()

if $mousePos1[0] = $mousePos2[0] and $mousePos1[1] = $mousePos2[1] Then

$idleCount += 1

Else

$idleCount = 0

EndIf

WEnd

Return 1

;MsgBox(0,"mouse pos","mousepos1 = " & $mousePos1[0] & " mousePos2 = " & $mousePos2[0])

EndFunc

;code-------------------------------------------------------------

Edited by John C.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...