Subject: | |
From: | |
Reply To: | |
Date: | Fri, 30 Nov 2007 21:04:43 +0000 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On 30 Nov 2007, at 19:12, Stockly, Ed wrote:
> Is there a shell command that will return how much time has passed
> since the
> last time a user moved or clicked the mouse or hit a key on the
> keyboard?
>
> ES
I use this for modifying Skype's status in an idle handler.
on checkSkypeIdle()
log "checkSkypeIdle()"
set r to rnd(do shell script "ioreg -c IOHIDSystem | perl -ane 'if(/
Idle/) {$idle=(pop @F)/1000000000; print $idle, \"\\n\"; last;}'")
if r < 600.0 then
checkSkypeStatusIsOnline()
else
checkSkypeStatusIsOffline()
end if
end checkSkypeIdle
(* Round to nearest (.5 away from zero) *)
on rnd(n)
n div 0.5 - n div 1
end rnd
Sorry to anyone who's code that I've used without referencing the
original author (Nigel?).
Simon
|
|
|