Re: Catching global keystrokes from cocoa
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