running a find and replace font action in illustrator

Hello-
I need to replace an old Helvetica font with a new open type version in a LARGE collection of files. I’m trying to create a script that triggers an action I recorded in illustrator. so far I’ve managed to cobble together a script to open a bunch of test files, but illustrator only runs the action on one file.

–get a sourceFolder that holds the files to print
set sourceFolder to (choose folder with prompt “Choose a folder with files to print:”) as text

– get a list of files of the files to be printed in the sourceFolder
tell application “Finder” to set workingFiles to (every file of folder sourceFolder) as alias list
repeat with workingFile in workingFiles
tell application “Adobe Illustrator”
open workingFile
set currentFile to front document
end tell
end repeat

–Part 2:
tell application “Adobe Illustrator”
do script “find and replace font” from “Eliz” without dialogs
do script “Action 1” from “Eliz” without dialogs
end tell

ideally i’d like to create something that opens one file at a time, runs my illustrator action, saves/closes, then opens the next file in the selected folder (i’m worried that opening up all my files at once will crash my machine).

any thoughts/help will be greatly appreciated! thanks!

liz

Hi Liz

You were almost there just stuff in the wrong order.
try this:

--get a sourceFolder that holds the files to print 
set sourceFolder to (choose folder with prompt "Choose a folder with files to print:")


-- get a list of files of the files to be printed in the sourceFolder 
tell application "Finder" to set workingFiles to (every file of folder sourceFolder) as alias list
repeat with workingFile in workingFiles
	tell application "Adobe Illustrator"
		open workingFile
		--do script "find and replace font" from "Eliz" without dialogs
		--do script "Action 1" from "Eliz" without dialogs
		close document 1 saving no
	end tell
end repeat

you may have to put in a delay while the action does its stuff!

Liz:
Alternatively you may be able to use the Batch function in the flyout of the Actions palette. You cannot chain actions together but since you didn’t have anything between your two Actions you may be able to concatenate the two into one superAction and use it for the Batch. (Batch will allow for saving in different destinations, save/close, etc.) If you do have a need for finer control then go with pidge’s framework.

Jim Neumann
BLUEFROG