Catching global keystrokes from cocoa
Catching global keystrokes from cocoa
- Subject: Catching global keystrokes from cocoa
- From: "Joshua Martin" <email@hidden>
- Date: Wed, 7 Jun 2006 10:35:38 -0700
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