在Automator中编辑文本 [英] Editing text in Automator

查看:175
本文介绍了在Automator中编辑文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个Automator服务,该服务可以接受隐藏的文本并将其替换为编辑后的版本.

I'd like to create an Automator service that can take the seletced text and replace it with an edited version.

选定的文本将类似于这是选定的文本".

The selected text will be something like "this is selected text".

然后输出将获取该文本并输出类似...

The output will then take that text and output something like...

一些预定义的开始(这是选定的文本,这是选定的文本)"

"Some predefined beginning(this is selected text, this is selected text)"

我以前用文件名做过类似的事情,但是用实际文本做过nr = ever.

I have done similar things with file names before but nr=ever with actual text.

有人可以指出我正确的方向吗?

Can someone point me in the right direction please.

谢谢

推荐答案

打开Automator时,请选择文档类型"服务.

Choose Service as you Document type when you open Automator.

使用运行applescript操作".

Use a Run applescript Action.

设置服务在任何应用程序中接收选定的文本" 勾选输出将替换所选文本.

Set Service receives selected 'text' in any application tick Output replaces selected text.

将此代码示例放在运行" applescript操作中:

Put this code example in the Run applescript Action:

 on run {input, parameters}

    set new_text to "this is selected text, " & input

    return new_text
end run

保存.

通过选择文本来尝试使用某些文本,然后按crtl +单击它以获取服务菜单. 导航至您的服务.

Try it out on some text by selecting the text and crtl+ click it to get the services menu. Nav to your service.

这篇关于在Automator中编辑文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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