Page 1 of 1

Catching keystrokes outside application

Posted: Sat Nov 21, 2009 2:50 pm
by DeanAU
Hey,

Is it possible to catch keystrokes (namily Left key, right key and spacebar) outside the application

(keylogger esk)

Re: Catching keystrokes outside application

Posted: Sat Nov 21, 2009 4:20 pm
by Klaus
Hi Dean,

short answer: no.


Best

Klaus

Re: Catching keystrokes outside application

Posted: Sat Nov 21, 2009 8:37 pm
by malte
Klaus, why not? - Because it is imoral? <g>

Dean,

you can set up a timer that listens to the keysDown. Something along these lines:
The app does not need to be in front for that to work.

Code: Select all

on mouseUp
  set the flag of me to not the flag of me
  if the flag of me then listenToKeyStrokes
end mouseUp

on listenToKeyStrokes
  switch
    case 32 is among the items of the keysDown
      put "space" -- do whatever makes sense here
    break
    default
      put the keysDown
    break
  end switch
  if the flag of me then send "listenToKeyStrokes" to me in 40 millisecs
end listenToKeyStrokes
Cheers,

Malte

Re: Catching keystrokes outside application

Posted: Mon Nov 23, 2009 6:12 pm
by Paul D
Malte is right. I also asked about it here... http://forums.runrev.com/phpBB2/viewtop ... 191#p16191

Re: Catching keystrokes outside application

Posted: Mon Nov 23, 2009 8:33 pm
by Klaus
Hi friends,

sorry, my fault, of course Malte is right!
Should get more sleep I think...