counting keystrokes

J. Landman Gay jacque at hyperactivesw.com
Mon Apr 25 22:50:52 EDT 2005


On 4/25/05 1:18 PM, sims wrote:

> I am using  Rev 2.5.1 on Mac OS X to count keystrokes that are typed
> in any application that I have running - it keeps a running total of how 
> many
> keys I hit no matter what applications I use (MS Word, Eudora, etc.).
> 
> I use one btn with the script shown below and one fld which I lock so
> I don't accidently place text in it and mess up my count.
> 
> When I try this same Rev file on Windows XP it doesn't work.
> Can anyone tell me what I might have to do to get this to work
> (keep a running total of the number of keys hit) on Windows?
> 
> Thanks in advance,
> sims
> ----------------------------
> 
> on mouseUp
>   busyHands
>           send "mouseUp" to me in 200 millisecs
> end mouseUp
> 
> 
> on busyHands
>   repeat
>     put the  KeysDown  into tKeys
>     if the KeysDown is not empty then
>       add 1 to fld "strokesClicks"
>       exit busyHands
>     end if
>     wait 10 millisecs with messages
>     if the optionKey is down then exit repeat
>   end repeat
> end busyHands

The repeat loop might be hogging the cpu and could cause problems. I'd 
suggest something like this if you were using only Rev:

global tCount

on rawKeyDown
  add 1 to tCount
  pass rawKeyDown
end rawKeyDown

But I'm not sure the keypresses would be passed to Rev if it weren't in 
front. I suppose you've already tried it.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list