views:

106

answers:

2

Hello, everybody.

I'm here to ask if any of you know how to develop an app for Mac OS X that keeps reading everything the user types in. An example of app that implements this behavior is Text Expander.

Text Expander reads everything the user types in, searching for abbreviations previously added on it. When one of this abbreviations is found, Text Expander replace the abbreviation form for the entire content related to that abbreviation.

So, I would like to know what resource of Objective-C or Cocoa let you do this kind of stuff.

P.S.: Just to mention, I'm not thinking about developing something like a key logger. I'm just curious and thinking about at developing a snippet platform.

A: 

Check up on Services:

http://homepage.mac.com/simx/technonova/tips/creating_a_service_for_mac_os_x.html

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/SysServices/introduction.html

That is one way to achieve this.

Nissan Fan
How does a service accomplish the goal of continuous monitoring of what the user is typing?
Peter Hosey
It's the "Safe" way to implement a feature like this without be intrusive on the user. You create a service that people can elect to us through the application.
Nissan Fan
+3  A: 

This can be done with CGEventTap, but it requires that your process is running as root or “access for assistive devices” is enabled.

Ahruman