Can't do save as in Illustrator CS

All I need to do is change some text in an Illiustrator file and then save it out under a different name. I want to do this several times. However, whenever the script tries to save, Illustrator comes up with an error that says, “Can’t save the illustration. The file couldn’t be found. ID = -43” Then, Applescript errors out saying, “Adobe Illustrator CS got an error: an Illustrator error occurred: -43 (‘ˇˇˇ’')” It seems like I should be able to do “Save As” on files, but it’s not working. The Applescript the generates this error is simply:


save document 1 in saveText 

where saveText is the path to what I want to save the file as. Please help if you can. Thank you.

P.S. My OS is 10.4.2

dnc253,

You can do something like this. This was a hurry up but might get you started.

tell application "Finder"
	set thePath to choose folder with prompt "Choose destination."
end tell
tell application "Illustrator CS"
	make new document
	set textRef to make new text frame in current document with properties {position:{200, 200}, contents:"this text"}
	save current document in thePath with options {name:"ThisTest", compatability:Illustrator 11}
end tell

Hope it helps.

Thank you very much for the input. I’ve been bogged down with some other things, so I haven’t been able to try it out, but it looks good. I’ll let you know what happens. Thanks.

Well, I tried what you have there, but it doesn’t seem to work. Illustrator beeps and then hops around in the Dock after the save command. Then I switch over to it and nothing happens and I don’t get any kind of dialog. Also, it appears that the script runs without any errors in AppleScript, but there aren’t any newly saved files. I’ll keep tweaking things and post what happens. Thanks for any additional help anyone can give.

dnc253,

Well, after much playing around with this I finally came up with a different approach. Try this. This script makes a new document itself, you name the file, and then it saves it to your chosen destination. Hopefully this will work much better.

tell application "Finder"
	set thePath to choose folder with prompt "Choose destination."
	display dialog "Name your file." default answer ""
	set fileName to text returned of the result
	set newFilePath to thePath & fileName as string

	tell application "Illustrator CS"
		activate
		set docref to make new document
		set textRef to make new text frame in docref with properties {position:{200, 200}, contents:"this text"}
		save docref in file newFilePath as Illustrator with options {compatibility:Illustrator 11, preview:color Macintosh, embed linked files:true}
	end tell
end tell

Let me know how it turns out. While using the scripting guide to do this I could not get it to save with the pdf compatible:true or embed all fonts:true options that you’re supposed to be able to do.

PreTech