Detecting key and mouse actions in the background
bonnmike at gmail.com
Sat Feb 7 17:52:02 EST 2015
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)
On Sat, Feb 7, 2015 at 3:08 PM, tbodine <bodine at bodinetraininggames.com>
> 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!
> Tom Bodine
> View this message in context:
> Sent from the Revolution - User mailing list archive at Nabble.com.
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the Use-livecode