Just tried it using a send loop.
local sRunning, sMouseLoc
on mouseUp
if sRunning is empty then put false into sRunning
put not sRunning into sRunning
set the label of me to "Running: " & sRunning
startloop
end mouseUp
command startLoop
if sRunning then
put the keysdown & cr
put the mouseloc after msg
send "startloop" to me in 50 millisec
end if
end startLoop
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)
On Sat, Feb 7, 2015 at 3:08 PM, tbodine <[email protected]>
wrote:
> Hi All.
>
> I'm working on a "get up and move" reminder app that needs to be aware when
> the user is working at the machine. Can a LC standalone (on Mac) detect key
> and mouse actions while LC is in the background?
>
> In my tests so far, it doesn't. Suggestions welcome!
>
> Thanks,
> Tom Bodine
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/Detecting-key-and-mouse-actions-in-the-background-tp4688595.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode