Hi, Jeff. If the original script saves without complaining, then so should my last one with the two suggested amendments. The only difference in their save code is that ‘newFile’ is an HFS path in the original, that’s turned into a file specification by placing the word ‘file’ in front of it. In mine, it is a file specification as returned by ‘choose file name’. Here’s the complete, corrected script again, in case anything went astray earlier:
on main()
tell application "Illustrator CS"
activate
if ((count documents) > 0) then
-- Get the path to the current document, if such a path exists.
try
set origPath to file path of current document as Unicode text
-- Rather uselessly, Script Editor and TextEdit return POSIX paths here.
-- Here's a trap in case Illustrator does the same.
try
origPath as alias
on error
set origPath to origPath as POSIX file as Unicode text
end try
on error
set origPath to ""
end try
-- Set a default save name for the document.
try
set currentName to name of current document
if (currentName does not end with ".eps") then set currentName to currentName & ".eps"
on error
set currentName to "Untitled.eps"
end try
-- Prompt for a save name and location. Default to the document's current location
-- if it has one, otherwise to the last one used by the application.
if ((count origPath) > 0) then
set newFile to (choose file name with prompt "Save this document as." default location (origPath as alias) default name currentName)
else
set newFile to (choose file name with prompt "Save this document as." default name currentName)
end if
-- Check that the ".eps" hasn't been lost from the name.
repeat until ((newFile as Unicode text) ends with ".eps")
set newFile to (choose file name with prompt "The name you choose must have have an ".eps" extension. Save this document as." default name currentName)
end repeat
-- Create the new file if it doesn't exist.
try
open for access newFile
close access newFile
end try
-- Save the document to it.
save current document in newFile as eps with options {class:EPS save options, preview:color Macintosh, embed all fonts:true, embed linked files:false, include document thumbnails:true, compatible gradient printing:true, CMYK PostScript:true, overprint:discard, PostScript:level 3}
end if
end tell
end main
main()
But don’t hesitate to speak up if it still doesn’t work properly.