From: John Joyce Date: 2007-12-30T09:18:03+09:00 Subject: Re: Can Ruby be a keylogger on Win/Mac? On Dec 29, 2007, at 5:53 PM, Frederick Cheung wrote: > > On 29 Dec 2007, at 22:42, John Joyce wrote: > >> You're going to have a hell of a time building a keylogger for OS X. >> You'll want to look into the input managers. The same thing for >> building an Input Method for another language. >> With that part of Cocoa, you could definitely monitor input. >> Beware though, the docs are dense, and there is big learning curve. >> Also, input methods tend to cross the gap between Cocoa and Carbon >> (basically between Obj-C and C frameworks) >> >> You might try an AppleScript layer that intercepts and then passes >> the same keystrokes... (System Events) >> > InputManagers are only loaded into applications that load the cocoa > runtime and are sort of on their way out. The lowlevel > functionality I would look at would be a CGEventTap (see CGEvent.h) > > Fred > > Shows how much I (don't) know... :) I was reading the (still terse docs) on the newer input manager system, but it was pretty heady. In abstracting it further for Cocoa, it seems they've also given it a steeper learning curve, which sophisticated input should have, since it is intended for handling complex language input really. It is interesting that the Core Graphics things hold many keys to input, supposedly geared toward game development? Perhaps there are some RubyCocoa CGxxxx wrappers?