Editing text in Automator

北慕城南 提交于 2019-12-31 02:31:26

问题


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

i.e.

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)"

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

Can someone point me in the right direction please.

Thanks


回答1:


Choose Service as you Document type when you open Automator.

Use a Run applescript Action.

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

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

Save.

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



来源:https://stackoverflow.com/questions/13495102/editing-text-in-automator

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