cant get this to work

Im trying to export from Illustrator as a tiff with certain preferances, If anyone can help it would be great

tell application "Illustrator CS"

	set user interaction level to never interact
	set documentCount to count documents
	repeat with i from 1 to documentCount
		set documentName to name of document 1
		export document 1 to file (targetPath & documentName) as TIFF 
			with options {class:TIFF, color:RGB, resolution:300}
	end repeat
end tell

It keeps wanting to make “TIFF” a variable

Where im going with this is to export as a tiff then open in photoshop change image size to 150 dpi then save as a jpeg.

I’ve never written save or export scripts plus I’m new and learning.

Model: powermac G5
Browser: Internet Explorer 6.0
Operating System: Mac OS X (10.3.9)

Checking out the Illustrator CS Dictionary, the only export options are: Flash/GIF/JPEG/Photoshop/PNG24/PNG8/SVG. Taking that into account, this works fine:

set targetFolder to choose folder with prompt "Location for exported files"
set targetPath to targetFolder as string

tell application "Illustrator CS"
	
	set user interaction level to never interact
	set documentCount to count documents
	repeat with i from 1 to documentCount
		set documentName to name of document 1
		export document 1 to file (targetPath & documentName) as Photoshop with options {class:Photoshop export options, resolution:300.0, color space:CMYK}
	end repeat
end tell

The only thing that doesn’t work properly is the resolution option“ it keeps exporting at the default of 150 no matter what I do. Like always, maybe I’m overlooking something :).

Exporting out as a JPEG works fine, but it only exports at 72dpi.

export document 1 to file (targetPath & documentName) as JPEG with options {class:JPEG export options, quality:10, antialiasing:true}

.

Since the resolution issue might be a hurdle for you, you can always save out as a .eps then rasterize that in Photoshop upon opening.

-N

starfox25,

Here’s a work around with what nedloh99 has. Maybe this will help.

set theFile to choose file with prompt "Choose the file"
set theDest to choose folder with prompt "Choose the destination."
tell application "Finder"
	set foldDestination to theDest as string
	set fileName to name of theFile
	set theDestPath to foldDestination & fileName & ".eps"
end tell

tell application "Illustrator CS"
	activate
	open theFile
	save current document in file theDestPath as eps with options {class:EPS save options, compatibility:Illustrator 11, preview:color TIFF}
	close current document
end tell
tell application "Finder"
	set theNewFile to theDestPath as alias
	set newFilePath to foldDestination & fileName & ".tif"
end tell
tell application "Adobe Photoshop CS"
	open theNewFile
	set theDoc to the current document
	
	set theHeight to height of theDoc
	set theWidth to width of theDoc
	--set frontmost of theDoc to true
	resize image theDoc width theWidth height theHeight resolution 300
	save current document in file newFilePath as TIFF with options {class:TIFF save options, image compression:LZW}
end tell

I had problems if another document was open in Photoshop with the frontmost line that is commented out. I couldn’t figure how to make sure the item worked on was the frontmost. Also the file being saved will still have .ai in the name. I didn’t include any code to eliminate this.

PreTech

You guys rock!!! This is really helping me learn ! Much Props!:smiley: