Jump to content

Idle TIme


ioliver
 Share

Recommended Posts

I wrote this script a while back, but I don't think I ever posted it. It checks for system Idle Time. There may already be lots out there.

; idle_time.au3
; March 8, 2004

; Checks to see if the system is idle for 5 seconds or more

Global $StartTime

Call("StartTimer")

While 1;Infinite Loop

  $MPos1 = MouseGetPos()
  $CPos1 = WinGetCaretPos()
  Sleep(1000)
  $MPos2 = MouseGetPos()
  $CPos2 = WinGetCaretPos()

  If $MPos1[0] <> $MPos2[0] Then
    Call("StartTimer")
  ElseIf $CPos1[0] <> $CPos2[0] Then
    Call("StartTimer")
  EndIf

  $EndTime = TimerStop($StartTime)
  
  If $EndTime > 5000 Then;5000 = 5 seconds
    MsgBox(0, "System Idle Time", "System Idle Time exceeded 5 seconds", 2)
  EndIf

Wend

Func StartTimer()
  $StartTime = TimerStart()
EndFunc

Hope you like it,

Thanks,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Decent script, although a clear limitation of that is keyboard use, since AutoIt can't hook all keyboard activity to test it. Doesn't windows maintain an idle time somewhere? I remember seeing an option in Gaim to use it's idle time, or the system's reported idle time. If that is correct, perhaps that is a way for your script to access that information so that it could include keyboard usage? Just a suggestion if you'd like to take on a challange :ph34r:

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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...