Reputation: 48059
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
Upvotes: 0
Views: 394
Reputation: 44331
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).
Upvotes: 3
Reputation: 243156
NSResponder * activeControl = [currentWindow firstResponder];
Upvotes: -1