views:

42

answers:

2

I want to get the currently selected item (text, image, etc) and display in my Cocoa app's window when a keyboard shortcut is hit. Droplr has functionality like this, for example. How do I go about doing this?

For example, I want it to return "(text, image, etc)" as text when that text selected on the screen like this: http://drp.ly/JAdv

A: 
NSResponder * activeControl = [currentWindow firstResponder];
Dave DeLong
+2  A: 

The easiest way is to write a service and assign a keyboard shortcut to it. Services are designed to do exactly this: operate on the selected text, graphics, etc. (or insert information at the selection).

Nicholas Riley