save illlustrator file

Hi All
I got every day some eps file and I open it and saved in the latest version with the following properties

Document Version: 10
File Preview: 8-bit (Mac)
Include Document Thumbnail: True
Embed all fonts: True

I developed a program but I am unable to set the above properties.
See my code below:


tell application "Finder"
	set thePath to (choose folder) as text
	set theFile to name of every file in folder thePath whose (name ends with ".eps")
end tell

tell application "Adobe Illustrator 10.0.3"
	activate
	set tot to count of theFile
	repeat with i from 1 to tot
		set fn to item i of theFile
		set fnm to thePath & fn
		open file fnm
		set myDoc to document 1
[b]		--save myDoc in file fnm as EPS with properties {class:EPS save options}
[/b]
		close myDoc saving yes
	end repeat
	--	quit application
end tell

The bolde matter I am unable to set.

Under there is another program which I took from this site, but it also not working
And the problem lies in the set user interaction


tell me to open {choose folder with prompt "Select the folder containing the files you wish to convert to Illustrator EPS."}

on open myFinderList
	repeat with myFinderItem in myFinderList
		tell application "Finder" to set myItemIsFolder to (kind of myFinderItem = "folder")
		if myItemIsFolder then
			tell application "Finder" to set myFolderContents to (every item of myFinderItem)
			open myFolderContents
		else
			with timeout of 864000 seconds
				tell application "Adobe Illustrator 10.0.3"
					set user interaction level to interact with self
					open myFinderItem as alias forcing CMYK
					set myDocumentName to name of document 1 & ".eps"
					set myDocumentPath to (file path of current document) as string
				end tell
			end timeout
			doProcessDocument(myDocumentName)
		end if
	end repeat
end open

on doProcessDocument(myDocumentName)
	saveDocument(myDocumentName)
end doProcessDocument

on saveDocument(myDocumentName)
	with timeout of 864000 seconds
		tell application "Adobe Illustrator 10.0.3"
			set myDocumentPath to (file path of current document) as string
			save current document in file myDocumentPath as eps with options {class:EPS save options, preview:color Macintosh, include document thumbnails:false, embed all fonts:false, CMYK PostScript:true, PostScript:level 2}
			delay 1
			close current document saving no
		end tell
	end timeout
end saveDocument

with timeout of 864000 seconds
	display dialog "The file(s) have been converted." buttons {"OK"} default button 1
	if button returned of the result is "OK" then
		tell application "Adobe Illustrator 10.0.3"
			quit
		end tell
	end if
end timeout


--set user interaction level to never interact 



And honestlly I am not a very perfect to understand whole the program.
Regards,
Rajeev

Listed on page 92 of the Illustrator 10 Scripting Guide are the options for EPS file saving. The line used to save out EPS files with your set up would be something like -


save document 1 in file fmn as eps with options {compatibility:Illustrator 10, CMYK PostScript:true, embed all fonts:true, include document thumbnails:true, preview:color Macintosh}

The part about ‘document thumbnails’ is optional in this case since the default value is already true.

For a process like this where you want to act on many files, you’ll appreciate having user interaction turned off! Otherwise the save dialog will come up every time. Turn off Illustrator’s dialog boxes right after you activate with:


tell application "Adobe Illustrator 10.0.3"
	activate
	set user interaction level to never interact --turns dialogs off.
--then process your files here...
set user interaction level to interact with all --turns dialogs back on.

With a few tweaks you should be ready to roll.
:slight_smile:

Hi when I try the following code:
set user interaction level to never interact
It give an error during compilation and the error is An identifier cann’t get after this identifier and the select text is user interaction.
Thanks & Regards
Rajeev