Akiles Posted April 20, 2011 Share Posted April 20, 2011 (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 April 20, 2011 by Akiles Link to comment Share on other sites More sharing options...
saywell Posted April 20, 2011 Share Posted April 20, 2011 You don't have to re-invent the wheel! Look this up in the helpfile: #Include <Timers.au3> _Timer_GetIdleTime() William Link to comment Share on other sites More sharing options...
Akiles Posted April 20, 2011 Author Share Posted April 20, 2011 (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 April 20, 2011 by Akiles 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