I picked up some code from another posted InD CS2 script that is close to what I want to do. I’m trying to export all pages from multiple InDesign documents in a big batch.
set FileSample to choose folder with prompt "Choose an input folder."
set outputPath to choose folder with prompt "Choose an output folder."
set folderName to name of (info for FileSample)
tell application "Finder" to set theFiles to files of folder FileSample whose name extension is in {"indd"}
repeat with oneFile in theFiles
set docName to name of oneFile
set outputPath to outputPath & docName as string
tell application "Adobe InDesign CS3"
activate
open (oneFile as alias)
tell EPS export preferences
--set applied flattener preset to flattener preset id 105 --seems to have errors
set bleed bottom to 0
set bleed inside to 0
set bleed outside to 0
set bleed top to 0
set data format to ASCII
set EPS color to unchanged color space
set EPS spreads to true
set font embedding to complete
set image data to all image data
set omit bitmaps to false
set omit EPS to false
set omit PDF to false
set OPI image replacement to false
set page range to all pages
set PostScript level to level 3
set preview to TIFF preview
end tell
export format EPS type to outputPath without showing options
tell front document
end tell
close without saving
end tell
end repeat
tell application "Finder"
activate
display dialog "All your EPS are belong to us." buttons "Ok" default button 1
end tell
You aren’t telling InDesign what you want to export. You need to tell it the Front Document receives the export command. Same with the close command following it.
set FileSample to choose folder with prompt "Choose an input folder."
set outputPath to choose folder with prompt "Choose an output folder."
set folderName to name of (info for FileSample)
tell application "Finder" to set theFiles to files of folder FileSample whose name extension is in {"indd"}
repeat with oneFile in theFiles
set docName to name of oneFile
set outputPath to outputPath & docName as string
tell application "Adobe InDesign CS3"
activate
open (oneFile as alias)
tell EPS export preferences
--set applied flattener preset to flattener preset id 105 --seems to have errors
set bleed bottom to 0
set bleed inside to 0
set bleed outside to 0
set bleed top to 0
set data format to ASCII
set EPS color to unchanged color space
set EPS spreads to true
set font embedding to complete
set image data to all image data
set omit bitmaps to false
set omit EPS to false
set omit PDF to false
set OPI image replacement to false
set page range to all pages
set PostScript level to level 3
set preview to TIFF preview
end tell
--I changed these next 2 lines
export front document format EPS type to (outputPath & ".eps") without showing options
close front document saving no
end tell
end repeat
tell application "Finder"
activate
display dialog "All your EPS are belong to us." buttons "Ok" default button 1
end tell
set FileSample to choose folder with prompt "Choose an input folder."
--we want outputPath as a string for later in the process
set outputPath to (choose folder with prompt "Choose an output folder.") as string
-- This line not needed --set folderName to name of (info for FileSample)
--set text item delimiters for later
set OldDelim to AppleScript's text item delimiters
tell application "Finder" to set theFiles to files of folder FileSample whose name extension is in {"indd"}
repeat with oneFile in theFiles
tell application "Adobe InDesign CS3"
activate
open (oneFile as alias)
--set delimiter to extension
set AppleScript's text item delimiters to ".indd"
--get the file name from ID since we are here anyway
set FileName to name of document 1
--Since the delimiter is the extension the first text item will remove the extension if it is part of the name
set FileName to first text item of FileName
tell EPS export preferences
--set applied flattener preset to flattener preset id 105 --seems to have errors
set bleed bottom to 0
set bleed inside to 0
set bleed outside to 0
set bleed top to 0
set data format to ASCII
set EPS color to unchanged color space
set EPS spreads to true
set font embedding to complete
set image data to all image data
set omit bitmaps to false
set omit EPS to false
set omit PDF to false
set OPI image replacement to false
set page range to all pages
set PostScript level to level 3
set preview to TIFF preview
end tell
--add the path, name and underscore together. ID ads the second underscore and page number automatically if there are more than one page to the document.
export front document format EPS type to (outputPath & FileName & "_" & ".eps") without showing options
close front document saving no
end tell
end repeat
set AppleScript's text item delimiters to OldDelim
tell application "Finder"
activate
display dialog "All your EPS are belong to us." buttons "Ok" default button 1
end tell