Best way to set up an idle timer
Edwin Gore
edgore at shinra.com
Thu Aug 14 17:21:01 EDT 2003
Understand that I have not given this even the slightest bit of thought before posting, but I think you are going to be better off using "send" to do this.
What you are going to want to do is something like this...
global gGoToSleep
on startup
send timeout in 5X60 seconds --for a 5 minute time out
put true into gGoToSleep
end startup
on rawkeydown
put false into gGoTo Sleep
pass rawkeydown
end rawkeydown
on mousemove
put false into gGoTo Sleep
pass mousemove
end mousemove
on timeout
if gGoToSleep is true then
-- do go to sleep type stuff
else
put true into gGoToSleep
end if
end timout
I think that should be enough to do it...it's hard to do anything with the mouse without moving, so I think that's all you need to capture.
Of course, I just made this up to avoid really working, so I didn't bother to check syntax or test this. But it should give you some ideas.
You are better off using send, since idle eats up processor time constantly checking. If you wanted to have it go to sleep EXACTLY five minutes after activity stopped, you would need to do some other complicated and boring things with checking the seconds and stuff.
>----- ------- Original Message ------- -----
I want to write a routine in my stack that will
>automatically log the
>user out after X minutes of inactivity, in the same
>way the screen
>saver will kick in after X minutes. Any mouse or
>keyboard event would
>reset the timer.
More information about the use-livecode
mailing list