I have no Applescript skills, so I was forced to use Automator for text editing. I have 7,000+ text files that need clean-up. The Automator script does the job nicely, but I can’t get the open command to loop. Using Tex-Edit in Automator, each file has to be chosen. (Or at least, that’s how it’s working for me …)
Here’s what I have so far:
set theFolder to choose folder without invisibles
tell application "Finder"
set theFiles to every file of entire contents of theFolder
repeat with i from 1 to count of theFiles
set thisFile to item i of theFiles as alias
tell application "Tex-Edit Plus" to open thisFile
tell application "Automator Launcher" to open "160gb Graphics:Users:Rick:Desktop:Clean HTML.app"
end repeat
end tell
The script fails on the Automator tell. I get an error that the connection has failed. I think I’ve made a mistake in the tell Automator line …
Any help is appreciated!
THANKS.
Model: MDD Digital Audio
AppleScript: 1.10.7
Browser: Safari 530.19
Operating System: Mac OS X (10.4)
I have the opposite problem – I know AppleScript but have never used Automator. You can clean up the AppleScript part thus:
set theFolder to choose folder without invisibles
tell application "Finder"
set theFiles to every file of entire contents of theFolder as alias list
repeat with aFile in theFiless
tell application "Tex-Edit Plus" to open aFile
--tell application "Automator Launcher" to open "160gb Graphics:Users:Rick:Desktop:Clean HTML.app"
end repeat
end tell
You might have more luck though if you told us what your Automator process does.
The automator workflow does the following in this order:
Search for "* " and replace with "ZZZ " – when I replaced with bullet character, it was deleted in step 6 cleanup, so this is a workaround
Delete lines containing “Royal ID:”
Delete lines containing “UPC:”
Delete lines containing “Vendor:”
Replace multiple blank lines with: Single Blank Line
Cleanup: Document stripping: Low ASCII (control) characters; High ASCII characters; Diacriticals (accents); Leading spaces and tabs; Trailing spaces and tabs; Double spaces between sentences
Fix line endings converting MS-DOS to Mac --takes out line feed returns
Search for "ZZZ " and replace with "¢ " --workaround for step 1
Delete LF (line feed) from beginning of text --This doesn’t get removed in Step 6 or 7
Close and save
Basically, I have an HTML file that has been stripped of all tags, using a Win XP program. I’m importing each of these files into a FileMaker Pro database for export to a shopping cart. (Virtuemart on Joomla!)
I know the automator workflow could be done in AS, but I don’t know how to write the script. (I’d also like to remove the text at the beginning to the space after the dash. This is the product description field, and I can remove it using a calculation in FM Pro.)