Jump to content
Sign in to follow this  

Help with idle script

Recommended Posts

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)     
    $mouse2 = mousegetpos(0)     
    if $mouse1 = $mouse2 then $counter = $counter+1     
    if $counter = $SecondsUntilConsideredAFK then Run("proba.bat")

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 

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 ?


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>


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")
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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...