Help. I’ve gotten rusty at Apple Script and can’t solve the following problem.
I was writing a batch script to save a specific artboard from an Illustrator file as an .eps. All’s good except something with the path name. The script below will save the artboard eps from the first file in the source folder and then fail with a dialog of “Adobe Illustrator got an error: File/Folder expected.” I can’t understand why the path works the first time but not after.
set ATID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"."}
tell application "Finder"
set source_folder to folder of the front window
set theFiles to every file of source_folder
set theSource to source_folder as text
end tell
repeat with i from 1 to count of theFiles
set thisFile to item i of theFiles
set thisName to name of thisFile
set thisNoExtName to text item 1 of thisName
set thePath to (theSource & thisNoExtName & ".eps") as text
open thisFile
tell application "Adobe Illustrator"
tell current document
save as eps in file thePath with options {class:EPS save options, save multiple artboards:true, artboard range:2}
end tell
close current document saving no
set thePath to ""
end tell
end repeat
set AppleScript's text item delimiters to ATID