Automator find and replace text string


Alastair Leith
 

Is there a basic find and replace text function in Automator? I can only find one for file name strings to use in the Finder (And I don’t want to change any file names, just copy their paths and display in a modified way.


Background

I often create file path strings for email messages to my team by drawing a file from Finder into terminal and then that resulting text into the Mail body text and Subject line.

E.g.
/Users/aleith/pCloud\ Drive/Screenshots/reseeding\ coral\ on\ GBR.jpg 

Then to be kind to non-techies I often replace all escaped characters will just the character and directory symbols “ ➤ “ with and arrow “➤” or something.

➤ Users ➤ aleith ➤ pCloud Drive ➤ Screenshots ➤ reseeding coral on GBR.jpg 

Apart from fact that Find and Replace in Mail is buggy as hell (only thing that works properly is ‘Replace All', which sometimes is the last thing I want to do as in example above), I figured why not make it all a contextual menu service in Finder so I select the files(s) and it generates a text string which then is copied to the clipboard.

I know I can write an AppleScript to do text substitution and copy to Clipboard, and then make that an Automator service, but surprised me I couldn’t find anything in Automator itself other than the Rename Finder Item, the only action that comes up when I search for “replace”.

Join applescript@apple-dev.groups.io to automatically receive all group messages.