John C. Posted October 5, 2006 Share Posted October 5, 2006 (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 October 5, 2006 by John C. Link to comment Share on other sites More sharing options...
John C. Posted October 5, 2006 Author Share Posted October 5, 2006 http://www.autoitscript.com/forum/index.ph...st&p=239504Thanks. That code looks better. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now