Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get selected text everywhere with xcode

Tags:

xcode

macos

I'm new with xcode developing. I can't find any free and easy-to-use translator on Mac OS, so I decide to write one myself.

The most important feature for this project is it can get text wherever in Mac OS, which means I can select the text in Preview when reading PDF files, either right-click-menu or system short-cut is ideal way to start my translator.

My major question is how to get the selected text in xcode when waking up my translator? If you can tell me how to register global right-click-menu or short-cut, I would also be very grateful.

Thanks :)

like image 617
Ovilia Avatar asked Nov 05 '22 15:11

Ovilia


1 Answers

Why not just write an app which registers itself as a Mac OS X Service (in the application Services menu) ? That will then interact with any Cocoa without any additional work. See http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/SysServices/introduction.html for details.

like image 144
Paul R Avatar answered Nov 14 '22 11:11

Paul R