Adobe Illustrator CS Scripting Guide
Example 26.1
This handler processes all Illustrator files in a specific folder, exporting each file as a medium-
quality JPEG image. Note that the class property is specified in the record to ensure that
Illustrator can determine the export option class.
-- fileList is a list of aliases to Illustrator files
-- destinationFolder is an alias to a folder where the JPEGs are to be exported
on ExportFilesAsJPEGMedium(fileList, destinationFolder)
set destinationPath to destinationFolder as string
repeat with aFile in fileList
tell application "Finder" to ¬
set fileName to name of aFile
set newFilePath to destinationPath & fileName & ".jpg"
tell application "Illustrator CS"
open aFile
export current document to file newFilePath as JPEG with options ¬
{class:JPEG export options ¬
, quality:60 ¬
, blur:0.5 ¬
, horizontal scaling:50.0 ¬
, vertical scaling:50 ¬
, matte:false}
close current document saving no
end tell
end repeat
end ExportFilesAsJPEGMedium
-- Call handler
set sourceFolder to choose folder with prompt "Source folder?"
tell application "Finder" to ¬
set fileList to every file of folder sourceFolder as alias list
set destinationFolder to choose folder with prompt "Destination folder?"
ExportFilesAsJPEGMedium(fileList, destinationFolder)
12 Aug 03
135