Jump to content

Recommended Posts

Posted (edited)

Probably something simple, but i'm trying to create a trigger that happens if the user is idle for too long (in this example 10 seconds).

#include <Timers.au3>

While 1
    $CurrIdleTime = _Timer_GetIdleTime()
    Switch $CurrIdleTime
        Case $CurrIdleTime >= 10001
            MsgBox(64,"Current Idle Time",$CurrIdleTime)
            Exit
    EndSwitch
WEnd

So if I run this and don't press anything the message box will trigger in 10 seconds, but if press anything the message box will immediately trigger.  The $CurrIdleTime given to me in the message box always reads 0 in the second scenario, so I'm not understanding why the case would trigger if it's clearly not greater than or equal to 10001.

Does moving the mouse/pressing a key cause _Timer_GetIdleTime() to very quickly go to another value than zero?  I tried specifying Number($CurrIdleTime), but it didn't make any difference.

Any insight would be appreciated, thank you.

Edited by silber
solved

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
×
×
  • Create New...