InDesign CS3 batch printing

I have a project I’m working on to print batches of InD files. I’m running in to some errors, some trouble reading the dictionary. I’ve commented out the errors in the code. I’ve spent a significantly smaller amount of my time in recent months on AppleScript, and I’m afraid it shows. I’m probably missing something simple, would anyone mind pointing out where I’ve been fumbling about?


on choosePrinter()
	tell application "Printer Setup Utility"
		set printerList to name of every printer
	end tell
	choose from list printerList with prompt "Choose the printer you wish to use."
	set thePrinter to item 1 of result
	
	tell application "Printer Setup Utility"
		set current printer to first printer whose name is thePrinter
	end tell
end choosePrinter

property scriptVersion : "0.3"
property theScriptDesc : "InDesign Print" & return & ""
display alert (theScriptDesc as string) message ("Version " & (scriptVersion as string)) giving up after 2 buttons "¢"

choosePrinter()
set FileSample to choose folder with prompt "Choose an input 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"} or kind contains "InDesign"

repeat with oneFile in theFiles
	set oneFileName to name of oneFile
	tell application "Adobe InDesign CS3"
		activate
		open (oneFile as alias)
		tell front document
			tell print preferences
				set page range to all pages
				--set data format to ASCII --Adobe InDesign CS3 got an error: Can't set data format of print preferences of document 1 to ASCII.
				--set scale mode to width height --Adobe InDesign CS3 got an error: Invalid value for set property 'scale mode'. Expected scale width height/scale to fit, but received nothing.
				set scale proportional to true
				set scale width to 100
				set page position to centered
				--set page orientation to portrait --Adobe InDesign CS3 got an error: Can't set page orientation of print preferences of document 1 to portrait.
				set mark offset to 0.0833 --as real?
				set page information marks to true
			end tell
			print without print dialog -- Error "Adobe InDesign CS3 got an error: Printing Error: Problem initializing the current printer. Check the system print settings."	
			close saving no
		end tell
	end tell
end repeat

tell application "Finder"
	activate
	beep
	display dialog "All input files have been printed." buttons "Ok" default button 1
end tell

Hello. Most of your issues are nothing more than just missing a word. The dictionary is very literal. :slight_smile:

This is device and/or PPD dependent, and may not be available. Using a print preset”rather than specifying properties”would keep you from having to code for this.

]set scale mode to scale width height

set print page orientation to portrait

Thanks Marc. I figured that it would be mostly simple syntax errors. The actual print command is tripping me up, though. I still get the following error. I’ve tried a few variations and still get the same error.

print without print dialog -- Error "Adobe InDesign CS3 got an error: Printing Error: Problem initializing the current printer. Check the system print settings."