|
|
Intercepting Keystrokes and Mouse clicks
|
|
|
|
Mac Enthusiast
Join Date: May 2002
Location: Cincinnati, OH
Status:
Offline
|
|
Back "in the day" I could use System Extensions to do tricky stuff like watch what the user is typing or clicking in any application. Now I don't know where to start with this kind of thing.
In summary, I want to capture "Command-P" or the selection of "Print..." from a specific application, do some stuff and then discard the event before the application recieves it.
Does this make sense?
Has anybody seen any code examples of something like this? I'd probably want to run as a Daemon, if I understand Daemons and how they work correctly. Of course, I don't know how to get my Daemon to see what apps are running, and filter these specifc events if the app it's looking for is running.
I don't necessarily want you to write the code for me! I just need to be pointed to some good reference material so I at least know where to start.
Thanks very much in advance...
|
TiBook 667 DVI - 20" Cinema Display - 20GB iPod
|
|
|
|
|
|
|
|
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
You can capture modifier sequences using Carbon HotKeys. Otherwise I think you'll need to write a kext or somethin'.
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: May 2002
Location: Cincinnati, OH
Status:
Offline
|
|
Thanks for the reply.
Now I have to expose myself as a complete boob. What is "Carbon HotKeys"? Is this an application, a code example, an Apple library, a new Subway sub? <img border="0" title="" alt="[Wink]" src="wink.gif" />
I tried a Google search on variations and hunches, but I didn't find anything relevant. I was really hoping to find something so I would have to come back here and be stupid.
|
TiBook 667 DVI - 20" Cinema Display - 20GB iPod
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
He means the "HotKey" API in Carbon. It involves calls like RegisterUniversalHotKey() or something. I'm not sure how well it interfaces with Cocoa in current releases of OS X, though.
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
Does anyone know how to intercept mouse and key stokes using the Cocoa API's? Someone suggested using the NSEvent class, I looked at it, but didn't no where to start.
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by macrophyllum:
<strong>Does anyone know how to intercept mouse and key stokes using the Cocoa API's? Someone suggested using the NSEvent class, I looked at it, but didn't no where to start.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Well, I'm no uber-guru or anything, but I don't think there's anything in the Cocoa API for doing that.
NSEvent does something similar, but it's not quite what you're asking for. As far as I know, NSEvents are for letting objects in an application respond to certain events in that application. I don't think you can normally get NSEvents from another application.
The only way I know of to do the sort of thing it sounds like you're wanting is, like they said, Carbon Events. Sorry. (That is, unless you can find a way to get your class into the app or something.)
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|