Tracking the Inactivity
[1/8] from: info::id-net::ch at: 4-Jan-1980 4:06
Hello all ! I want to make execute some functions from my application, when the user doesn't work on it. My solution is to track the inactivity of the user. Is there a way to make it, without using too much of resources ? Philippe Oehler
[2/8] from: info:id-net:ch at: 20-Jan-2003 15:59
Someone got an idea ?
[3/8] from: ljurado:bariloche:ar at: 20-Jan-2003 12:36
From this script you can get how track mouse activity. I don't know about get keyboard activity :( Luis rebol  scr-size: system/view/screen-face/size view/new/offset layout [ size (scr-size / 3) b: box blue scr-size / 8 rate 15 feel [engage: func [face action event] [append b/effect [draw [circle event/offset / 8 2]] show b if action <> 'time [f/text: action show f]]] ] 0x0 do-events ----- Mensaje original ----- De: Philippe Oehler <[info--id-net--ch]> Para: <[rebol-list--rebol--com]> Enviado: Lunes 20 de Enero de 2003 11:59 AM Asunto: [REBOL] Re: Tracking the Inactivity
[4/8] from: g::santilli::tiscalinet::it at: 20-Jan-2003 17:11
Hi Philippe, On Monday, January 20, 2003, 3:59:54 PM, you wrote: PO> Someone got an idea ? One way could be to have a timer that is reset each time you get an event from the user (mouse click etc.). You set a face's rate so to get a time event, say, one time a second. In that face's feel you decrement a counter. Each time you get an event from the user you reset the counter; if the counter gets to zero, then the user has been inactive for the time counted by the counter. HTH, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[5/8] from: rotenca:telvia:it at: 20-Jan-2003 17:27
> > My solution is to track the inactivity of the user. Is there a way to make > > it, without using too much of resources ?
With a View gui? --- Ciao Romano
[6/8] from: amicom:sonic at: 20-Jan-2003 8:15
Philippe, What you probably want is to use WAIT. If you are waiting for network activity, 'wait on the listen port with a time limit. Check the return type of 'wait and you'll know if it returned because of port activity or timeout. You can also do the same for keyboard input. Instead of using 'input, 'ask or something like that, open a console port and 'wait on that with a time limit. Do the same as above. If this is the case and the script is already written, it could require some heavy tweaking to support this. Bohdan "Bo" Lechnowsky Lechnowsky Technical Consulting At 03:59 PM 1/20/03 +0100, you wrote:
[7/8] from: sunandadh:aol at: 20-Jan-2003 12:57
> My solution is to track the inactivity of the user. Is there a way to make > it, without using too much of resources ?
A method that might work with View: -- Have a single global variable, initialised to 0 -- First thing any action facet does is add 1 to it -- Last thing any action facet does is subtract one from it. So forgetting serialisation problems and other issues, if the variable is zero, nothing else is going on. -- Have another action facet that runs in a wait loop checking this variable and doing stuff while it is zero. A sort of working sketch is below. But you have some issues to resolve: -- make the "background" process run automatically, and just once (right now you have to click it to start, and could run it more than once); -- I'm not sure view really supports this sort of multi-tasking. Do a LOT of stress testing before thinking of going live with something like this. hth Sunanda. rebol  unview/all activity-count: 0 view layout [ button "thing 1" [ activity-count: activity-count + 1 loop 50 [prin "/\" wait 0.1] print "" activity-count: activity-count - 1 ] button "thing 2" [ activity-count: activity-count + 1 loop 50 [prin ". " wait 0.1] print "" activity-count: activity-count - 1 ] button "Background" [ nn: 0 forever [ wait 0.25 if activity-count = 0 [ loop 10 [ if activity-count <> 0 [break] nn: nn + 1 print ["Idle time -- " nn] wait .05 ] ;;loop ] ;; forever ] ;; action ] ;; layout ]
[8/8] from: greggirwin:mindspring at: 20-Jan-2003 12:30
Sunanda et al, One of the problems with tracking activity for individual faces is that it gets out of hand very quickly. I think you could probably do this with insert-event-func, setting the time for the last event(s) you're interested in, and maybe having a timeout port or something that checks those timestamps periodically. It will add a bit of overhead to everything passing through your event-func though, so keep it as light as possible. -- Gregg