I went thru your script and borrowed some, streamlined others, since I’ll eventually be making scripts to do this sort of thing on a “server” with drop folders or a web interface that allows access to our department art as PDFs. I’ve just now gone from OS8.5 into the beginnings of a modern workflow and haven’t flushed out all the bugs, but this seems to work. Thot I’d share and make note why I changed what I did.
on open fileList
set destpath to (choose folder) as string
repeat with i from 1 to count of items of fileList
set theFile to item i of fileList
set fileInfo to (info for theFile)
set fileName to name of fileInfo
--Determine whether to use InDesign subroutines or Quark subroutines
if (kind of fileInfo starts with "InDesign") then -- Process as InDesign
my createInDesignPDF(theFile, destpath, (text 1 thru -6 of fileName))
else if (kind of fileInfo starts with "Quark") then -- Process as Quark
my createQuarkPDF(theFile, destpath, (text 1 thru -6 of fileName))
else
display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 6
--return will exit script and not process other files in repeat, omiting 'return' will skip only those that are neither QXP or ID
end if
end repeat
end open
on createInDesignPDF(theFile, destpath, docName)
tell application "Adobe InDesign CS3"
open theFile
set theProps to properties of PDF export preset "[C2Media_PDF]"
set newProps to {view PDF:true, crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
set oldProps to properties of PDF export preferences
set properties of PDF export preferences to newProps
export front document format PDF type to (destpath & docName & ".pdf") without showing options
set properties of PDF export preferences to oldProps
close front document saving no
end tell
end createInDesignPDF
on createQuarkPDF(theFile, destpath, docName)
set tempPSfile to (path to temporary items as string) & "tempPS.ps"
tell application "QuarkXPress"
open theFile
set theDoc to object reference of document 1
--print setup record can be checked for settings you may need to specify
--return print setup of theDoc
(*{class:print setup record, object reference:print setup record 0 of document "Medical Catalog" of application "QuarkXPress", output setup:"Process SWOP", bleed:"0p", absolute overlap:true, auto tile overlap:"18p", back to front:false, collate:false, data format:binary data, fit in area:true, flip horizontal:false, flip vertical:false, full res rotated objects:false, halftone screen:"106", include blank pages:false, invert image:false, orientation:portrait, page gap:"0p", page position:center position, page sequence:all pages, paper offset:"0p", paper size:"Letter", paper size list:{"A4", "A5", "A6", "B5 (JIS)", "Legal", "Letter", "Executive", "5.5x8.5", "8x13", "8.25x13", "8.5x13", "Com10 Env.", "Mon. Env.", "C6 Env.", "C5 Env.", "DL Env.", "16K", "Custom"}, paper width:"51p", paper height:"p.015", print quality:normal, print spreads:false, print thumbnails:false, printer type:"Generic B&W", printer type list:{"Generic B&W", "Generic Color", "Generic Imagesetter", "Generic PDF", "AdobePDF 8.0"}, reduce or enlarge:"94%", registration marks:off, registration marks offset:"6 pt", resolution:600, separation:false, tiling:off} *)
tell print setup of theDoc
set previousPaperSize to paper size --we'll need this later
--may want to check for the printer type name of AdobePDF on your system
set checkPrinterType to printer type list
if checkPrinterType does not contain "AdobePDF 8.0" then ¬
error "Distiller not installed!"
--if that works then free to set all needed properties of the PDF printout
--can also be done with custom output setup, ie;
--ignor print setup record and create an output setup, then
--set output setup to "postscript to PDF Settings"
set printer type to "AdobePDF 8.0"
set paper size to previousPaperSize --default for AdobePDF page is "Screen" so it must be set to original page/paper size
set fit in area to false
set reduce or enlarge to "100%"
set registration marks to off
--print to file (temporary postscript file)
print theDoc PostScript file tempPSfile
close theDoc saving no
end tell
end tell
--then create the PDF
my distillPSfile(tempPSfile, destpath, docName)
end createQuarkPDF
on distillPSfile(tempPSfile, destpath, docName)
set pdfPath to destpath & docName & ".pdf" as string
tell application "Adobe Acrobat Professional"
open tempPSfile with invisible
save document 1 to pdfPath
close document 1
end tell
--this method has Acrobat Pro use Distiller to convert file
--so it launches in addition to Acrobat Pro when converting
--I think it can also be scripted with Distiller directly and
--without using Acrobat Pro, but I've not tried to flush it out
end distillPSfile