Script for saving a PDF from Illustrator CS

I’m trying to modify the script for Illustrator CS to use a PDF Preset that I created called IA_Docs. I’m not very familiar with Applescript and my script keeps getting stuck on the new line I created. Can anyone help?

It gets stuck on this line:
with options {class:PDF save options, PDF preset:IA_Docs}

FULL SCRIPT:
– Get a location for the exported files
set targetFolder to choose folder with prompt “Location for exported files”
set targetPath to targetFolder as string

tell application “Illustrator CS”
– Turn off user interaction so dialogs don’t cause the script to get stuck
set user interaction level to never interact

--	Count the open documents
set documentCount to count documents

--	Export each open document
repeat with i from 1 to documentCount
	
	--	Get the document's name to use for creating a file path to save to
	set documentName to name of document 1
	
	--	Perform the save
	save document 1 in file (targetPath & documentName) as pdf ¬
		with options {class:PDF save options, PDF preset:IA_Docs}
end repeat

end tell

Before executing the script, create an Adobe PDF preset in illustrator with the name IA_Docs.

Hope this helps
JaiM

– UPDATED FOR CS4, probably works in CS5 as well. Not tested though

– Eddie Albert

– Get a location for the exported files
set targetFolder to choose folder with prompt “Location for exported files”
set targetPath to targetFolder as string

tell application “Adobe Illustrator”
– Turn off user interaction so dialogs don’t cause the script to get stuck
set user interaction level to never interact

--    Count the open documents 
set documentCount to count documents

--    Export each open document 
repeat with i from 1 to documentCount
	
	--    Get the document's name to use for creating a file path to save to 
	set documentName to name of document i
	
	--    Perform the save 
	--   substitute whatever Illustrator PDF preset you want for YourPresetName. Leave the Quote marks
	save document i in file (targetPath & documentName) as pdf with options {class:PDF save options, PDF preset:"YourPresetName"}
	
	
end repeat
close every document saving no

end tell