问题
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