0

I currently have an Automator workflow that uses Textwrangler to trim text files down for me.

These files are often full of the same bits of code and spaces, so I made a workflow where I click the Automator action which grabs all the text files in a folder, then uses a Dispense Items Incrementally action to pass them through Automator, where an Applescript runs multiple find/replace queries on each file, before saving and repeating.

All this time, I sit there while the files open, are edited and then closed & saved.

Is there not a way to do this without opening the files themselves? Could I not just tell Textwrangler (using some Applescript command) to grab that folder's text files, mess around with them in the background, and then save them?

The problem with opening them all up on your screen is it increases the chance of some error intefering with the workflow - quite often the workflow encounters some error and so I have to run it again.

(E.g. the way Automator might reduce jpeg picture size in the background is ideal.)

Thanks - happy to take any suggestions!

Tardy

tardy pigeon
  • 225
  • 6
  • 18
  • Update: Half sorted it now by experimenting! Still need some help... Found a way of doing it in Applescript: **tell application "TextWrangler" to replace "\\r\\r\\r" using "\\r\\r" saving yes searching in {file "Macintosh HD:My Music, Work, Writings and Etexts:PDFs, Etexts, Kindle Books and .txt files:KindleReads:"} options {search mode:grep, case sensitive:false, match words:false, extend selection:false, showing results:false}** BUT: Can't educated quotes that way using a similar command: **tell application "TextWrangler" to educate quotes {file "Macintosh HD:KindleReads:"}** Tardy – tardy pigeon Jan 24 '15 at 13:37
  • have you thought about using a programming language like Ruby in your terminal for this instead of Automator? – Andrew Hendrie Mar 05 '15 at 02:41

0 Answers0