Sign in to follow this  
Followers 0
Akiles

Help with idle script

3 posts in this topic

#1 ·  Posted (edited)

Hi, i have this script, isnt written by me, found it here im the forums, some user named "alex OF DEATH" posted it

I've got a kiosk mode pc, i want to close IE, close openoffice and reopen the IE again if the user is idle more than 5min, for those things im running taskkill im a bat so

this is the code to detect idle mouse.

$counter = 0 
$SecondsUntilConsideredAFK = 60 

while 1     
    $mouse1 = mousegetpos(0)     
    sleep(10)     
    $mouse2 = mousegetpos(0)     
    if $mouse1 = $mouse2 then $counter = $counter+1     
    if $counter = $SecondsUntilConsideredAFK then Run("proba.bat")
    sleep(990)
wend

the problem is that it runs the bat 1 time only, after that the script is paused

i tried this:

$x = 2
while $x = 2 
wend

but isnt working either, so any ideas to make the script looping over and over again without pause? also i want to ask since this isnt my code why is the "sleep(990)" needed ?

Thanks.

Edited by Akiles

Share this post


Link to post
Share on other sites



You don't have to re-invent the wheel! Look this up in the helpfile:

#Include <Timers.au3>
_Timer_GetIdleTime()

William

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You don't have to re-invent the wheel! Look this up in the helpfile:

#Include <Timers.au3>
_Timer_GetIdleTime()

William

Yeah, thanks so much, im new with autoit didnt know that func, i manage to did this one, is working fine

#include <Timers.au3>


while 1 
Sleep(10 * 1000)
Global $iIdleTime = _Timer_GetIdleTime()

if _Timer_GetIdleTime() > 60000 Then Run(proba.bat")
WEnd
Edited by Akiles

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