• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Catching global keystrokes from cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Catching global keystrokes from cocoa


  • Subject: Re: Catching global keystrokes from cocoa
  • From: Dan Messing <email@hidden>
  • Date: Wed, 7 Jun 2006 13:27:18 -0500

You might want to check out the second half of this post:

http://www.rogueamoeba.com/utm/posts/Random/Homegrown_Developer_Tools

Dan Messing
Stunt Software
http://www.stuntsoftware.com/


On Jun 7, 2006, at 1:14 PM, Joshua Martin wrote:

Hello all...

I'm attempting to write a utility to help in playing a game.  The
basic gist of the application is that it will via a timer send two
keystrokes to the application to mimic physically holding down those
keys on the keyboard.  (Specifically this is warcraft 3 and the [ and
] keys which will keep unit health bars up at all times).

I have the send keys portion worked out but need the ability to watch
for when the user attempts to send a chat message so i can stop the
send keys (otherwise it will fill the chat window with the sendkeys).
The most basic way to do this i suspect is by catching the enter key
(which starts a chat message) then catching the enter key again when
the message is sent.

I've researched it as much as i can and have found that I can use the
carbon api InstallEventHandler with a target from
GetEventMonitorTarget method to catch keystrokes globally (this also
requires assistive devices from the accessibility panel).  This works
great from carbon but i would like to know if its possible to do this
from cocoa.  I was able to get it working partially by calling the
carbon api RunApplicationEventLoop.  This however made my UI hang
(since its a blocking call).

Can someone steer me in the right direction.  I've been searching and
experimenting for a couple days on this with no luck.

Thanks in advance...
-josh

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: NSAddImage() error on 10.2.8
  • Next by Date: vararg functions in frameworks
  • Previous by thread: Re: Catching global keystrokes from cocoa
  • Next by thread: NSAddImage() error on 10.2.8
  • Index(es):
    • Date
    • Thread