Sign in to follow this  
Followers 0
John C.

idle time out

2 posts in this topic

#1 ·  Posted (edited)

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0