Catching keystrokes outside application

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DeanAU
Posts: 1
Joined: Sat Nov 21, 2009 2:48 pm

Catching keystrokes outside application

Post by DeanAU » Sat Nov 21, 2009 2:50 pm

Hey,

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

(keylogger esk)

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Catching keystrokes outside application

Post by Klaus » Sat Nov 21, 2009 4:20 pm

Hi Dean,

short answer: no.


Best

Klaus

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Re: Catching keystrokes outside application

Post by malte » Sat Nov 21, 2009 8:37 pm

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

Paul D
Posts: 116
Joined: Mon May 21, 2007 6:58 pm

Re: Catching keystrokes outside application

Post by Paul D » Mon Nov 23, 2009 6:12 pm

Malte is right. I also asked about it here... http://forums.runrev.com/phpBB2/viewtop ... 191#p16191

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Catching keystrokes outside application

Post by Klaus » Mon Nov 23, 2009 8:33 pm

Hi friends,

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

Post Reply