ioliver Posted March 5, 2004 Share Posted March 5, 2004 I've created a script to run IE in kiosk mode. The script prevents users from using any of the Ctrl + shortcut keys, and closes some common pop-up windows. I'd also like to have the script close the web browser after 1 minute of idle time. Is there a way to use AutoIt v3 to count system idle time? Thanks for your help. Ian Oliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
Valik Posted March 5, 2004 Share Posted March 5, 2004 You can do it, but not necessarily with such a direct route. You can set up a loop that polls 2 things: The caret position (WinGetCaretPos) and the Mouse (MouseGetPos, I think). If either of those have changed since the last poll, reset the timer (See TimerStart, TimerStop). That should go in an infinite While loop which you must break out of yourself (Use TimerStop and compare the return value to 60000 (1 minute in ms)). Link to comment Share on other sites More sharing options...
ioliver Posted March 5, 2004 Author Share Posted March 5, 2004 Thanks Valik, I'll try that. "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
ioliver Posted March 5, 2004 Author Share Posted March 5, 2004 Here's my script so far: Call("StartTimer") While 1 ;Infinite Loop $MPos1 = MouseGetPos() Sleep(1000) $MPos2 = MouseGetPos() If $MPos1[0] <> $MPos2[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 --- But when I run it, I get this message: Line 14 (File "C:\Scripts (that I've written)\idle_time.au3"): $EndTime = TimerStop($StartTime) $EndTime = TimerStop(^ ERROR Error: Variable used without being declared. --- Any idea's? Thanks again. "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
Developers Jos Posted March 5, 2004 Developers Share Posted March 5, 2004 You need to do a Global $STARTTIME to define. Here a version of your script coded a bit different but with the same logic... Global $STARTTIME,$MPOS1,$MPOS2 $MPOS2 = MouseGetPos() Call("StartTimer") While 1;Infinite Loop $MPOS1 = MouseGetPos() If $MPOS1[0] <> $MPOS2[0] Then Call("StartTimer") $MPOS1 = $MPOS2 EndIf If TimerStop($STARTTIME) > 5000 Then;5000 = 5 seconds MsgBox(0, "System Idle Time", "System Idle Time exceeded 5 seconds", 2) EndIf Wend Func StartTimer() $STARTTIME = TimerStart() EndFunc ;==>StartTimer SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
scriptkitty Posted March 5, 2004 Share Posted March 5, 2004 (edited) In proper programing, you should call out all variables first. My little version: AdlibEnable ("testmouse") $begin=0 $time=0 $MPos1 = MouseGetPos() $MPos2 = MouseGetPos() $curpos1=WinGetCaretPos() $curpos2=WinGetCaretPos() winclose("mouse") AutoItWinSetTitle ( "mouse" ) While 1 testmouse() Wend Func testmouse() If TimerStop($begin)>1000 Then $begin = TimerStart() $MPos2 = MouseGetPos() $curpos2=WinGetCaretPos() Else $MPos1 = MouseGetPos() $curpos1=WinGetCaretPos() EndIf If $MPos1[0] = $MPos2[0] and $curpos1[0]=$curpos2[0] and $curpos1[1]=$curpos2[1] Then If $time=0 Then $time = TimerStart() ToolTip("No user input for "&int(TimerStop($time)/1000)+1& " seconds", 0, 0) Else ToolTip("") $time=0 EndIf EndFunc edit... added detect cursor in case you were only on keyboard. Edited March 5, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
ioliver Posted March 8, 2004 Author Share Posted March 8, 2004 Thank for all the help. You guys are awsome. Now I can add this to my Kiosk scripts to automatically log uses out. Thanks again, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
tazlikesrobots Posted June 29, 2005 Share Posted June 29, 2005 Thank for all the help. You guys are awsome. Now I can add this to my Kiosk scripts to automatically log uses out.Thanks again,Ian<{POST_SNAPBACK}>I found this tool while researching a similar problem. The program can be configured to run a script after a certain amount of idle time has elapsed. Best of all FREEWARE! http://www.softpedia.com/progDownload/Idle...load-18756.html 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