illustrator/freehand export swf

I have about 10000 .eps that need to export via Freehand or Illustrator into .swf. I have a set folder structure that needs to remain the same. I have never even heard of Applescript until I got this task, so needless to say, I have no idea where to start. I am assuming that I would somehow write a script to open all .eps and export into same folder that it was opened from. Is this possible with Appleescript? If so, can anyone shed light on what I need to do or point me in the general direction of good tutorials? I have not been able to find any so far.

Many thanks in advance

FreeHand isn’t a very scriptable app out of the box but I do some scripting with it and what you are looking for should be fairly easy. There is one potential problem though, if the EPS file you are exporting to Flash contains fills, strokes, or images that are incompatible with Flash you will get a dialog every time it hits the save command which would mean you would have to either hit the Okay button for all 10000 eps files, or you would have to install a third party app such as “Okey Dokey” that dismisses dialogs. You’ll have to test out your EPS files to see if they contain anything that would trigger such a dialog.

Take the following script, and copy it into a new Script Editor document. If you are using a different version of FreeHand than me you’ll have to change that in the script. Then, compile and save the script. You can run it right from the Script Editor, or if you save it as an Application you can just double click the application icon to start it.

Here is the script:

--ask user to choose a folder
set sourceFolder to choose folder with prompt "Choose a folder of EPS files"

--get the name of every EPS file in the chosen folder
tell application "Finder" to set fileList to get the name of every file of sourceFolder whose file type contains "EPS"

--repeat with each eps name found
repeat with thisFile in fileList
	--get just the name of the file, drop the extension
	set charCount to the (count of characters in (thisFile as string)) as integer
	set minusExt to (charCount - 4) --this is the count of characters less the 4 character ".eps" extension
	set fileName to characters 1 thru minusExt of thisFile as string
	
	
	--define the full path to the file
	set thisPath to sourceFolder & thisFile as string
	--define the full path to what will be the saved SWF file
	set newPath to sourceFolder & fileName & ".swf" as string
	tell application "FreeHand 8.0.1"--change this to whatever version you are running
		--bring FH to the front
		activate --this is optional if you are only opening/saving/closing files
		--open the file
		open alias thisPath without Dialogs --(use without dialogs to avoid font or linked image warnings)
		--let FreeHand catch up
		Update
		(*save the file as a Flash document...
		you may get a dialog with every save that warns you
		that some fills or strokes or images that are not
		compatible with the flash format which would reduce
		the convenience of the script a little, and force you
		to hit the okay button every time it hits this line.*)
		save in file newPath as "Flash"
		--again, let FH catch up
		Update
		--close the document without saving
		close last document saving no
	end tell
end repeat

If you have any problems, post them back here…

Best,

Thanks. The only problem I had was with "tell application “Finder” to set fileList to get the name of every file of sourceFolder whose file type contains “EPS” " . It wasn’t finding any of the files even though all files had the .EPS extension. I simply removed the whose file type contains “EPS” and it seems to be working great. Thanks again