OS X Get highlighted text

会有一股神秘感。 提交于 2019-12-11 15:57:05

问题


I'm interested in writing a plugin for OS X to support multiple operations on highlighted text in the right click context menu. The operations are simple enough that I could write them by myself. I've looked at automator's "Copy to Clipboard" action, but it requires some text input first. The "Get contents of Clipboard" action will make my operations require the highlighted text to first be copied to the clipboard.

So the question is simple: how do I access the system wide highlighted text buffer? Or is this strictly off limits?

Thanks!


回答1:


There's no such thing as "the system wide highlighted text buffer"; just selecting text doesn't move it to a central location like the clipboard. And since you can have text selected in multiple windows at once, it's not really clear what that would even do.

Have you considered using the services menu? It's specifically designed to allow third party apps to provide operations for users to perform on selected text.



来源:https://stackoverflow.com/questions/1151417/os-x-get-highlighted-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!