Detect scroll activity (when LC is not frontmost)

Terry Vogelaar tvogelaar at
Mon Dec 26 00:25:04 EST 2016

Thank you, Mike, for this! This is what I was searching for indeed. And you're right; I want to detect activity, not just scrolling. Scrolling was the only activity I could not catch yet, hence the subject line. But this does exactly what I want.

Fortunately I can not replicate the issue with 10.12 with typing. I am on 10.12.2, so maybe it has already been fixed. 

This is a priceless Christmas gift to me. Wow!

With kind regards,
Terry Vogelaar

> Op 25 dec. 2016, om 18:19 heeft use-livecode-request at het volgende geschreven:
> I have an answer..
> Heres a sample script:
> local sRunning
> on mouseUp
> if sRunning is empty then put false into sRunning
> put not sRunning into sRunning
> loopit
> end mouseUp
> command loopit
> if sRunning then
> put the last word of (shell("ioreg -c IOHIDSystem |grep Idle")) into tIdle
> put tIdle / 1000000000 into field 1
> send "loopit" to me in 2 sec
> end if
> end loopit
> The script is in a button, and I have a single field on the card.  The math
> is done to convert to seconds of idle.
> The are only 2 disclaimers here.  First is that the value returned pre 10.3
> is hex so you'd have to handle that if you have an earlier osx.  10.3 and
> after this solution should work fine.
> The second issue is is that on mac 10.12, the idle time won't update on
> typing.  Its an osx issue for that specific version, but worst case you
> already have a method to track keypresses.

More information about the use-livecode mailing list