Illustrator : Export to JPEG....

HI,

tell application "Adobe Illustrator"
	activate
	tell document 1
		repeat with i from 1 to (count of layers)
			set visible of every layer to false
			set visible of layer i to true
			set NameOfLayer to name of layer i
			set selection to every page item of layer i
			
			-- you must group the everything on the layer to get the bounds of the objects
			tell application "System Events"
				tell process "Adobe Illustrator CS2"
					keystroke "g" using command down ---> just changed this line
				end tell
			end tell
			set sHeight to height of selection
			set sWidth to width of selection
			
			tell application "System Events"
				--undoing the grouping will perserve your artwork
				keystroke "z" using command down
			end tell
			copy selection
			tell application "Adobe Illustrator"
				make new document with properties {height:(sHeight + 5.0), width:(sWidth + 5.0)}
			end tell
			paste
			save in ("" & ((path to current user folder) & ":Desktop:" & NameOfLayer & ".pdf")) as pdf
			tell application "Adobe Illustrator"
				close document 1 without saving
			end tell
		end repeat
	end tell
	close document 1 without saving
end tell

I would like to transform this code to Export layers as JPEG in 300 dpi.

Thanks

JP

Well,
with this code, i can Export layers ti JPEG but i don’t find how i can Export JPEG in high def (300 dpi)

set whereTo to path to desktop as string
tell application "Adobe Illustrator"
	set fileName to ".jpg"
	set t to current document
	
	set c to count every layer of t
	repeat with y from 1 to c
		set lName to name of layer y of t
		set thePath to whereTo & lName & fileName
		my layerVis(thePath, lName)
		
	end repeat
end tell

on layerVis(thePath, lName)
	tell application "Adobe Illustrator"
		set x to current document
		set visible of every layer of x whose name is not lName to false
		set visible of layer lName of x to true
		
		
		export x to file (thePath) as JPEG with options {class:JPEG export options, quality:100, optimization:true, saving as HTML:false, horizontal scaling:100, vertical scaling:100} ¬
			
		
		
		
		
	end tell
end layerVis
tell application "Adobe Illustrator"
	close document 1 without saving
end tell

it looks like the only way to st the resolution in in jpeg format is to export to flash SWF to a search in the dictionary for JPEG you’ll see:D

Hi

You might want to consider rasterizing each layer before you save then you can specify what resolution.

thanks Pidge1 but i don’t see how i can do that.
For the moment, i’ve replace :
export x to file (thePath) as JPEG with options {class:JPEG export options, quality:100, optimization:true, saving as HTML:false, horizontal scaling:100, vertical scaling:100} ¬
by
export x to file (thePath) as JPEG with options {class:JPEG export options, quality:100, optimization:true, saving as HTML:false, horizontal scaling:417, vertical scaling:417} ¬

all exports are 72dpi whilst you can scale the art you have changed the bounds. This then may require resizing the image afterwards, so i prefer to just open in photoshop to size and resolution.