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