OS X获取突出显示的文本 [英] OS X Get highlighted text

查看:72
本文介绍了OS X获取突出显示的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣为OS X编写一个插件,以支持右键单击上下文菜单中突出显示的文本的多项操作。这些操作非常简单,我可以自己编写。我已经看过自动器的复制到剪贴板操作,但是首先需要输入一些文本。 获取剪贴板的内容操作将使我的操作要求首先将突出显示的文本复制到剪贴板。

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?

谢谢!

推荐答案

没有系统范围内突出显示的文本缓冲区之类的东西;仅选择文本并不能将其移动到剪贴板等中央位置。而且,由于您可以一次在多个窗口中选择文本,因此甚至不清楚该怎么做。

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.

这篇关于OS X获取突出显示的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆