PDA

View Full Version : Global Shortcut to get selected text/image in Application




fabianpimminger
Dec 28, 2011, 01:30 PM
I'm trying to build an app that get's selected text from other applications if a certain shortcut/hotkey is pressed. First I tried the Carbon Hotkey API, but then I couldn't get selected text from other applications. Second I've tried building a service that gets the selected text from other applications and is called with a global shortcut, but I wasn't able to use a custom shortcut. Somehow only CMD+SHIFT is allowed as a modifier in the plist and these kind of shortcut is already used in many applications so it's often not working. CTRL and a key would be a cool shortcut, because not many applications use this kind of shortcut, but I can't specify such a modifier.

Any Ideas how to solve this problem?



kainjow
Dec 28, 2011, 08:16 PM
Probably need to write a background app that uses the Carbon API (or maybe the new 10.6+ NSEvent API) to capture the hot key, then get the selected text for the active app.