Re: Detecting key and mouse actions in the background
Just tried it using a send loop.
local sRunning, sMouseLoc
if sRunning is empty then put false into sRunning
put not sRunning into sRunning
set the label of me to "Running: " & sRunning
if sRunning then
put the keysdown & cr
put the mouseloc after msg
send "startloop" to me in 50 millisec
I set the msg box where I can see it, clicked my button to toggle the loop
on, and as i'm typing this, if I move the mouse, the mouseloc is updating,
and every key I press pops up.
Will this do what you want? Should be a simple thing to track the mouseloc
and compare it to the previous hit, 50 millisec is probably more often than
you need the check too. And you can check to see if the keysdown is
empty. If its empty enough times in a row, and the mouseloc doesn't change
in the same period, you can guess the person is afk. (though, if they go
face down on the keyboard all bets are off)
Thanks, Mike. It helped to see your approach. I was using keydown and mousedown handlers and that was not detecting events outside of the LC app itself. So I adapted your method using the keys down and mouseloc, and it works nicely. Thanks!