Prompt With Default Folder Path

I am new to this forum and new to Applescripting. (If I posted this to the wrong place, please let me know.)

I received a lot of help on Adobe U2U forum. One such script that works fantastic is the below script for Illustrator CS. The script helps our operators save files with the correct EPS settings. The one limitation to this script is how the file path defaults to the last place Illustrator saved to, rather than to the default folder path of the current document. Unfortunately, I need the script to always prompt the user to select the file path (since they “sometimes” do not save to the same folder path that the file originated from). So I was hoping the script could be modified so that the file default to the folder path that the file originated if it had one. (For new documents, this script works needs no changes.) Can someone help me out. I have been racking my brain, and I don’t think I could ever figure this out myself.

tell application "Illustrator CS"
	try
		set origPath to file path of current document as text
	on error
		set origPath to ""
	end try
	
	set saveLocation to (choose folder with prompt "Select location to save file:")
	set currentName to name of current document
	set nameInput to (display dialog "Please enter new file name:" default answer currentName)
	set newName to text returned of nameInput
	
	if text -1 thru -4 of newName = ".eps" then
		set newFile to saveLocation & newName as text
	else if newName does not contain ".eps" then
		set newFile to saveLocation & newName & ".eps" as text
	end if
	
	if origPath = newFile then
		display dialog "A file with this name already exists. Do you want to replace it with this new file?"
	else
		try
			open for access file newFile
			close access file newFile
		end try
	end if
	
	save current document in file 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 tell

Model: mac
Browser: Safari 312
Operating System: Mac OS X (10.3.9)

Hi, Jeffkr.

The command you want is probably ‘choose file name’. It presents a standard navigation dialog with which the user can interact and returns a file specification to the script. It also handles any warnings to the user if an item with the entered name already exists at the selected location. In Tiger and (I think) Panther, you can optionally set a ‘default location’ for the save. (However, this option isn’t available in Jaguar.)

I don’t have Illustrator, but assuming the script you posted does work, you may be looking at something like this:

tell application "Illustrator CS"
	-- 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.
	set currentName to name of current document
	if currentName does not end with ".eps" then set currentName to currentName & ".eps"
	
	-- 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 user hasn't lost the ".eps" 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) as Unicode text
	end repeat
	
	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 tell

Nigel,
I can’t thank you enough. This is SO close to perfect. Please, I beg of you, if you could help me with one parameter I could set this script live with our operators.
The only thing, which happens often, is that operators often have to “change” the name of the file when saving.
Presently this script errors out when the name is changed.
Could this be fixed to prevent that?
Please understand I am not trying to be a burden. I will attempt to look into it, but I thing your skills would solve this dilemma much faster and with better code :slight_smile:
-jeff

Hi, Jeff.

Thanks for the feedback. Sorry I’ve been so long replying, but I’ve been out today.

I’m not sure what you mean by ‘“change” the name of the file when saving’. Do you mean saving the document under a different name (as a different file)?

Looking again through the code I posted, I see I left in an ‘as Unicode text’ near the end that shouldn’t be there. That might be causing the problem. (Does the error occur after the script’s admonished you for not using an “.eps” extension? Perhaps that’s what you meant by changing the name of the file?) As I said, I don’t have Illustrator, so I’m not able to test the ‘save’ process in that environment.

Anyway, here’s the script again with that bit corrected. Many apologies for the error. I hope it works properly this time. Do let me know if it doesn’t. :slight_smile:

tell application "Illustrator CS"
	-- 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.
	set currentName to name of current document
	if currentName does not end with ".eps" then set currentName to currentName & ".eps"
	
	-- 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 user hasn't lost the ".eps" 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
	
	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 tell

Nigel,
You have no idea how pumped I am with this script!!!
It is really close.
It seems to work perfectly but there are some issues.
You were right in your assumptions. Sometimes the operators change the name of the file name, your amendment seems to cover this. But oddly, it only allows one change? For example: I can open a file that was already saved. (TestDocument_1.eps) and run the script. In the Save As dialog box I can change teh name to (TestDocument_2.eps) and the script will function fine. But if I were to try to run the script again on that newly saved file, and try to give it a new name (TestDocument_3.eps) it errors out saying the file couldn’t be found?
Aslos, our operators often open a file from one folder and then save it to a different folder. This script, presently does not allow for that.
Could such things be accounted for? Seriously, it is so close. I could really use your help. There is no way I can do this on my own. Yet I did make an RGB to CMYK script. -that is the extent of my scripting skills :frowning:
Please Nigel, I can really use your help if you are still willing?

jeff

OK. I get errors too in that situation with similar scripts for TextEdit and Script Editor, but not the same errors. The problems seem to be cured in these applications by updating the ‘path’ of the still-open document (the equivalent of the ‘file path’ in Illustrator, if your original script was correct) to refer to the file just saved. This automatically updates the window name too. Would you care to give this version a try with Illustrator? (I’ve assumed here that Illustrator’s ‘file path’ is a POSIX path. This may need to be changed.)

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
			
			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}
			-- Update the current document to refer to the saved one.
			set file path of current document to POSIX path of newFile
		end if
	end tell
end main

main()

Hello Nigel,
This present script has an odd behavior worth mentioning which may help.
Let me explain using two examples of 2 separate files that were previously saved.
The first is an EPS named: TestDocument_1.eps
The second is a JPEG named: TestDocument_1.jpg

If I open TestDocument_1.eps and run the script (and change the name in the save dialog box to TestDocument_2.eps), the script errors saying the file can’t be found.

Note: (It works fine if I don’t change the name”I receive an overwrite warning first, and I could then save it”no errors)

If I open TestDocument_1.jpg and run the script (and change the name in the save dialog box to anything different, example “NewNameDocument.eps” the script will work fine).???
But if I run the script again on that “newly saved” file “NewNameDocument.eps” and change its name to something unique, the script will error out saying the file can’t be found.???

This seems to be the same behavior for all files that were not EPS files, such as .jpg, .ai, .pdf (even with a name change besides just its extension). All such different files will work with for the “First” initial run of the script).
But once such a file is converted to an EPS, and I try to save that file with a new name the script will error saying it can’t find the file.

I hope this makes sense. Please let me know if you need more information.
Thank you,
-Jeff
p.s. Nigel, I sent you a .mov file showing the result of the first scenario mentioned above.

Jeff:

I am curious as to the environment and reasons for your script. I’ve worked in electronic Prepress for MANY years and it sounds like something you would find in that field. But I’m curious as to WHY you are doing what you’re doing.

Can you describe the conditions that would necessitate a rename versus a resave ?
I can see someone resaving .eps files to make sure they’re compliant with a given workflow.
I can see renaming them if you want to leave the originals intact.
Why would you process a .jpg file this way? You just and up with a (natively) vector file with a raster document embedded. Why not just process JPG’s through Photoshop and use the resulting files?

Also, if you have a file “jeffsFile.jpg”, the current code would save a file named “jeffsFile.jpg.eps” ! Is this acceptable?!?

I had put together a script after your second post but then as I read I became confused as to your actual needs.

Sorry for butting in…
Jim Neumann
BLUEFROG

Hi Jim,
No problem,
You are not butting in by no means. You have many valid points. Our operators don’t usually have to save to a different name but it does happen when they are working on various copies or items that fall outside our normal workflow. Since we work in an extremely production based workflow, processing many Illustrator pieces, I really want to be able to save all files exactly the same way no matter what situation, to ensure accuracy 100%.
Because.
The main point of this script is to have operators always save Illustrator EPS files with the correct EPS settings. (they often fail to check a box, such as Preserve Gradient Mesh Printing)

Sorry about the .jpg example. it was just an example. And yes, the double extension would obviously be an issue. If such an instance would occur, such as with PDFs, the operator would omit the .pdf.
Along those lines, our operators do take PDF files taken from a FTP client, drag them to a local folder, then open them in Illustrator, isolate the vector art, and then save this as an Illustrator EPS file. They may even save the file directly to a folder within a mounted Appleshare volume”which gets imported to our database.
(I am not saying this workflow is perfect. - but with over 100 operators, it is difficult to construct an workflow that is followed perfectly by all operators all the time.)

Also, operators often work within a “work_in_progress” folder. So the operator may grab a file off our server, place it in the “work_in_progress” folder, and save that Illustrator piece to different file names. Just as working copies, and refer back to them later.
Also, we run across instances of versioning. Whereas an operator will work on a full color illustrator piece, then modify it two a 2 color Illustrator piece and save it with a different name.) We cannot always change the file name prior to opening the Illustrator piece. Well, we could I suppose, but this may create more of a confusion and also create some potential lost files.
I am sorry, it is very difficult to describe all scenarios, but they do exist. Changing procedures is on the agenda.
But this script is an excellent safeguard, and so close to working upon covering all scenarios.
I would still love to see what you had in mind. Who knows, changing procedures may be an alternative?

Thanks,
jeff

That’s weird. If it weren’t for the script working OK on the first save, I’d say that Illustrator’s ‘save’ command wasn’t actually creating new files for itself: merely saving documents to existing files. I notice that your original script creates new files before invoking the ‘save’ command. (The ‘open for access’ followed by ‘close access’.) I left that out because I considered it a superfluity, but maybe the original scripter knew something I don’t. Try inserting these four lines before the ‘save’ command at the end:

try
	open for access newFile -- creates the file if it doesn't exist.
	close access newFile -- closes the unneeded access to it.
end try

Jim. You’re certainly not butting in. If you’re familiar with Illustrator’s scripting eccentricities, or if you’ve any better ideas for the vanilla code or for the approach generally, any input would be welcome. :slight_smile:

Nigel,
I think you are on to something. But I am receiving a new unique message when executed the script, regardless of changing the file name or not. If I did not change the file name the overwrite message would still appear, and I would continue. Then the Error message occurs:
AppleScriptError.
Adobe Illustrator CS got an error: Property is read/only and cannot be changed.
That box has an “OK” button.

Also, the Script Editor is highlighting the line towards the end that reads:
set file path of current document to POSIX path of newFile

I don’t know if this helps or not.
Any guesses?
Thanks for still trying on this. I really do appreciate this!!!

jeff

OK Gentlemen, here we go…:smiley:


tell application "Illustrator CS"
activate
	--Inits
	set docExists to false -- Assume document does not exist
	set {defaultButton, initialSaveButtons, saveDialog, dummyname} to {"Save", {"Save", "Cancel"}, "Press Save to continue", ""} -- Inital dialog setup
	-------
	try
		set fpath to file path of document 1 -- Get the file path of the document
		tell application "Finder" to set {ftype, saveLocation} to {name extension, container} of fpath -- get the extension and container of the file for the save location
		set fname to my processFilename(fpath, ftype)
	on error -- It's an unsaved NEW document, not an opened file (jpg/pdf/etc.) Could occur if someone does a copy and paste to a new document or creates a new document from scratch.
		set fname to (text returned of (display dialog "Unsaved document. Please enter a filename." & return & "The .EPS extension will be added automatically." default answer "")) & ".eps" -- Provide a name for the new document
		set saveLocation to choose folder with prompt "Choose a destination folder:" -- Provide a destination folder
		set ftype to "" -- Null value since the file does not exist
	end try
	
	set dummyname to fname
	repeat until docExists is true -- This will loop until a unique filename is provided or the user cancels.
		set saveChoice to (display dialog saveDialog buttons initialSaveButtons default answer dummyname default button defaultButton) -- Give the operator the option of Renaming the file on save. Since it's an extra dialog to deal with, the "Save" option is default so they can just hit "Enter".
		if button returned of saveChoice = "Rename" then
			set fname to ((text returned of saveChoice) & ".eps") as string
		else if button returned of saveChoice = "Save" and (text returned of saveChoice) ≠ dummyname then
			set fname to ((text returned of saveChoice) & ".eps") as string
		end if
		set savePath to ((saveLocation as string) & fname) as string
		if button returned of saveChoice ≠ "Overwrite" then -- If "Overwrite" is not chosen then check for the doc's existence.
			set {docExists, initialSaveButtons, defaultButton, saveDialog, dummyname} to my checkForFile(savePath, initialSaveButtons, defaultButton, saveDialog, dummyname)
		else
			set docExists to true -- If Overwrite is chosen then exit the loop and save over the existing file.
		end if
	end repeat
	
	-- This is a hack to get around a bug in Illustrator. saving an .ai to a .ai, .eps to .eps doesn't work. (error -43 File not found)
	if ftype = "eps" then
		set savePath to my createFile(savePath)
	end if
	
	-- And finally! the save!
	save current document in file savePath 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 tell

on processFilename(fpath, ftype)
	tell application "Finder"
		if name of fpath ends with ftype then
			set fname to (characters 1 through (-(((count of ftype) + 2))) of (name of fpath as string) & ".eps") as string -- Need an extra 1 because AS doesn't count the "."
		else
			set fname to ((name of fpath) & ".eps") as string -- If it doesn't have the extension, then add it.
		end if
	end tell
end processFilename

on checkForFile(savePath, initialSaveButtons, defaultButton, saveDialog, dummyname)
	tell application "Finder"
		if exists (file savePath) then
			return {false, {"Overwrite", "Rename", "Cancel"}, "Rename", "This File already exists!" & return & "Overwrite or Provide a filename", ""}
		else
			return {true, {"Save", "Cancel"}, "Save", "Press Save to continue", dummyname}
		end if
	end tell
end checkForFile


on createFile(savePath)
	tell application "Finder"
		open for access alias savePath
		close access alias savePath
	end tell
	return (savePath as string)
end createFile

Jeff: I did a lot of validation on this. I didn’t use every trick in the book, but you’ve got some dynamic dialogs, repeat until flags, etc. :stuck_out_tongue: I tried to comment pretty liberally so you could (hopefully!) follow what’s going on and what I was thiinking.

It will work on an unsaved document, a file opened in AI (like when you drop a jpg on the AI icon in the dock) and native .ai and .eps files. It checks for the existence of the files and prompts you to rename them or overwrite. It makes coffee and shines your shoes… uh… Anyways, there is one little GUI thing you might find odd… if you have an unsaved document you are presented with a dialog to name the file, then a dialog to choose the destination, then you are prompted with another dialog (which is the main dialog seen with saved files). In this dialog you can rename the initial name you gave it or just hit “Enter” to save. (You’ll notice it shows you the proper name with the .eps extension added.) You could also change the choose folder option to point to the “work_in_progress” folder if you wanted. (And it WILL work on a JPG file!)

Have fun with it and et me know if you have any problems. (This kind of stuff is part of my job so I’m used to hearing “Yeah, but what if it did THIS instead of THAT!”)

Cheers,
Jim Neumann
BLUEFROG

Thank you Jim.
I have no problems with the extra dialog boxes. But I have to comment on a few possible areas of concern.
Presently this script doesn’t let the operator choose the file path if one existed. This is actually important, since they do not always save to the same folder.
(An area of concern in the past was having the script default to an existing path if it had one”which would be visible, and changable if necessary)
The initial script worked very well but it had that one limitation”the path had to “always” be set since it was using Illustrators last path.

Also, on your script, the initial dialog box that appears lets an operator change the file name. If they change the name and leave .eps on the filename, the script returns a file with .eps.eps at the end of the filename.
It would be great, if it was implied that no file extension would yield .eps. So that if I file existed as TestDocument.eps and the operator decided to change its name to TestDocument the script would give an overwrite message. (Since .eps would be appended via the script).
That was on the present script”a nice safeguard, since we always require .eps and how often a new employee doesn’t understand the importance of such things!
On your script, when and if the overwrite dialog box appears, its name field is empty. It would be ideal if it contained the default name. Since sometimes operators are only changing a slight variance of a long filename. So having to rewrite the entire name may yield mistakes.
Yes, this all sounds like nitpicking, but it is enough to stop it from going in production. Crazy yes, I wish I could change our operators and pay grade, but that is a whole other issue of concern.
I hope you don’t think I am complaining. This is also very close to perfection.
Thank you,
jeff

So in other words :slight_smile:
This script is working very nicely.

And I should point out, I have no objections with an operator always setting the path. The way this script works with new files is very acceptable, yet I do go on to mention a request. (And I really like your verbiage regarding automatically appending the .eps) ” Btw, any chance it could default to the name “Untitled.eps” in that dialog box? (Sounds goofy, but operators often delete from the extension back and type a new file name)”yet, this is not a necessity.

Now if an operator was to set a path for all documents, including those already saved, it needs to have it default to its file path being selected (if it had one). I should have been more clear, and stated that it can’t bypass the user intervention and assume the file will be saved to its same location.
This is odd, and hence the reason why you asked prior the reason for such bizarre file management on our behalf.

Btw, I hope you don’t give up on me.
After all our last names are too much alike.
Thanks,

Jeff Reumann :slight_smile:

The below comment interests me since this seems to be related to the only thing holding Nigels latest script from working?

– This is a hack to get around a bug in Illustrator. saving an .ai to a .ai, .eps to .eps doesn’t work. (error -43 File not found)
if ftype = “eps” then
set savePath to my createFile(savePath)
end if

Right. Thanks. That’s the line I stuck in last time to make the still-open document refer to the just-saved file. It helped with Script Editor and TextEdit on my machine, but if ‘file path’ is a read-only property in Illustrator, you’re obviously better off without it. Just delete it. I don’t know if anything will be required in its place. Just have to see. :slight_smile:

Jim’s script looks very thorough. I’m looking forward to reading through it later on.

Hi Nigel,
If it helps, removing that line yields this error when changing a file name:
First the system gives an error:

Can’t save the Illustration. The file couldn’t be found. ID = -43

If I click “OK”

The error then appears: The object “Save As” is not cureently available.
with “Stop” and “Continue” buttons.

If I click “Stop” I receive the following error:

AppleScript Error
Illustrator CS got an error: an Illustrator error occured: -43('^^^")

Jeff: You’re a hard person to please !:smiley: (Just kidding) I adjusted some code and gave the operator the option of picking the “Same Folder” or “Other”. (I hate throwing so many dialogs at people but if you’re OK, I’m OK!) Also, the “.eps.eps” is fixed (one of my code adjustments.) Now, if the filename typed by the operator contains the extension, it will be ignored (of ir will be added if it’s not present.) Try this…


global ftype
tell application "Illustrator CS"
	activate
	--Inits
	set docExists to false -- Assume document does not exist
	set {defaultButton, initialSaveButtons, saveDialog, dummyname} to {"Save", {"Save", "Cancel"}, "Press Save to continue", ""} -- Inital dialog setup
	-------
	try
		set fpath to file path of document 1 -- Get the file path of the document
		tell application "Finder" to set {fname, ftype, saveLocation} to {name, name extension, container} of fpath -- get the extension and container of the file for the save location
		set fname to my processFilename(fname)
	on error -- It's an unsaved NEW document, not an opened file (lpg/pdf/etc.) Could occur if someone does a copy and paste to a new document or creates a new document from scratch.
		set fname to (text returned of (display dialog "Unsaved document. Please enter a filename." & return & "The .EPS extension will be added automatically." default answer "")) & ".eps" -- Provide a name for the new document
		set fname to my processFilename(fname)
		set ftype to "" -- Null value since the file does not exist
	end try
	set destChoice to (button returned of (display dialog "Save to same folder or new destination?" buttons {"Same Folder", "Other", "Cancel"} default button "Same Folder"))
	if destChoice = "Other" then
		set saveLocation to choose folder with prompt "Choose a destination folder:" -- Provide a destination folder
	end if
	
	set dummyname to fname
	set ftype to "eps"
	repeat until docExists is true -- This will loop until a unique filename is provided or the user cancels.
		set saveChoice to (display dialog saveDialog buttons initialSaveButtons default answer dummyname default button defaultButton) -- Give the operator the option of Renaming the file on save. Since it's an extra dialog to deal with, the "Save" option is default so they can just hit "Enter".
		if button returned of saveChoice = "Rename" then
			set fname to (text returned of saveChoice) as string
		else if button returned of saveChoice = "Save" and (text returned of saveChoice) ≠ dummyname then
			set fname to (text returned of saveChoice) as string
		end if
		set fname to my processFilename(fname)
		set savePath to ((saveLocation as string) & fname) as string
		if button returned of saveChoice ≠ "Overwrite" then -- If "Overwrite" is not chosen then check for the doc's existence.
			set {docExists, initialSaveButtons, defaultButton, saveDialog, dummyname} to my checkForFile(savePath, initialSaveButtons, defaultButton, saveDialog, dummyname)
		else
			set docExists to true -- If Overwrite is chosen then exit the loop and save over the existing file.
		end if
	end repeat
	
	-- This is a hack to get around a bug in Illustrator. saving an .ai to a .ai, .eps to .eps doesn't work. (error -43 File not found)
	if ftype = "eps" then
		set savePath to my createFile(savePath)
	end if
	
	-- And finally! the save!
	save current document in file savePath 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 tell

on processFilename(fname)
	if fname ends with ftype then
		set fname to (characters 1 through (-(((count of ftype) + 2))) of fname & ".eps") as string -- Need an extra 1 because AS doesn't count the "."
	else
		set fname to (fname & ".eps") as string -- If it doesn't have the extension, then add it.
	end if
end processFilename

on checkForFile(savePath, initialSaveButtons, defaultButton, saveDialog, dummyname)
	tell application "Finder"
		if exists (file savePath) then
			return {false, {"Overwrite", "Rename", "Cancel"}, "Rename", "This File already exists!" & return & "Overwrite or Provide a filename" & return & "(The .EPS extension is added automatically.)", dummyname}
		else
			return {true, {"Save", "Cancel"}, "Save", "Press Save to continue", dummyname}
		end if
	end tell
end checkForFile


on createFile(savePath)
	tell application "Finder"
		open for access alias savePath
		close access alias savePath
	end tell
	return (savePath as string)
end createFile

Let me know.
Jim

Gentlemen:

I am leaving for the day and won’t have access to my Mac until tomorrow morning. I’ll watch the thread from home and keep notes if anything needs to be tweaked.
Have a good night.
Jim Neumann
BLUEFROG

Ok,
I know I am writing probably faster than you can read and/or respond.
But I wanted to repost this initial script.
This particular script below was very close with only “one” limitation. It did not default to the file path of a document if it already had one. In other words, it defaulted to Illustrator last path it saved to.
I just didn’t want this one to get erased from one’s memory because it may be easier to modify this rather than creating newer routes?

Thank you both, for all your time and help.

tell application “Illustrator CS”
try
set origPath to file path of current document as text
on error
set origPath to “”
end try

set saveLocation to (choose folder with prompt "Select location to save file:")
set currentName to name of current document
set nameInput to (display dialog "Please enter new file name:" default answer currentName)
set newName to text returned of nameInput

if text -1 thru -4 of newName = ".eps" then
	set newFile to saveLocation & newName as text
else if newName does not contain ".eps" then
	set newFile to saveLocation & newName & ".eps" as text
end if

if origPath = newFile then
	display dialog "A file with this name already exists. Do you want to replace it with this new file?"
else
	try
		open for access file newFile
		close access file newFile
	end try
end if

save current document in file 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 tell