I need to script converting Freehand 10 (.fh10) files to AI CS3. This conversion is best done by “saving as” to an EPS file - AI’s “Freehand import” filter tends to munge the image.
The script below works, except for the “tell Illustrator” block. I haven’t been able to get AI to open the resulting EPS file - various errors result, depending on the syntax I try. AI will open the EPS consistently when I icon-drag the file by hand.
Part of the problem is that Freehand 10 has sketchy scripting support. “Save in [path] as MacEPS” works but doesn’t return anything, so there’s no result to pass to AI.
Any help is appreciated!
set the file_list to {}
set the rawName to ""
set the epsName to ""
tell application "Finder"
set convertThese to (selection)
repeat with convertMe in convertThese
set the rawName to characters of (name of convertMe as string)
set thePath to POSIX path of (container of convertMe as alias)
set the epsName to (rawName) & ".eps" as string
tell application "FreeHand 10"
open convertMe
tell document 1 of it -- yes, you really need this line for the save command to work
save it in (thePath & the epsName) as MacEPS
close it
end tell
set the file_list to the file_list & (thePath & the epsName)
end tell
end repeat
end tell
repeat with openMe in file_list
tell application "Adobe Illustrator"
open (openMe as alias)
end tell
end repeat