Adobe Illustrator CS Scripting Guide
Example 105.1
This example shows to batch process folders of Illustrator documents, saving each as a PDF file
with specific settings.
-- Processes all files in folders dropped on this script
-- (when saved as an applet) and save each Illustrator file as a PDF file
on run
tell me to open {choose folder}
end run
on open droppedItems
set destinationFolder to choose folder with prompt "Destination folder?"
repeat with anItem in droppedItems
tell application "Finder"
-- Make sure each item processed by this script is a folder
if class of item anItem is not folder then
-- Not a folder, notify the user of the error
display dialog "Please drop only folders on this script"
else
-- It is a folder, so get the Illustrator files in it and process them
set fileList to ¬
(every file of anItem whose creator type is "ART5") as alias list
end if
end tell
-- See PDF save options section for isolated example of this handler
SaveFilesAsPDF(fileList, destinationFolder)
end repeat
end open
-- fileList is a list of aliases to Illustrator files
-- destinationFolder is an alias to a folder where the PDF files are to be saved
on SaveFilesAsPDF(fileList, destinationFolder)
set destinationPath to destinationFolder as string
repeat with aFile in fileList
12 Aug 03
277