I have a script that will take the current InDesign Document and create a postscript file using print (to later be distilled).
I’ve discovered that while the script is running, sometimes if the user hits the return or enter keys while InDesign is active and the script is working, the resulting ps file will not contain any placed art from the InDesign file. I’ve kinda alleviated the issue by making sure InDesign is not active while it is working, so keypresses don’t trigger this issue…but if during the script running you click to make Indesign active and then hit return/enter, the issue happens again.
I can’t always get the issue to trigger, so it’s been very hard to figure out if one particular line of code is at fault…
Does anyone know why this would happen, and is there a way to completly prevent this from happening?
set {activeFilename, psOutputFolder} to printPS()
-- *******************************************************************************
-- *******************************************************************************
on printPS()
tell application "Adobe InDesign CS3"
activate -- Can remove this to help, but not totally prevent
set autoPreset to "AutoPost Setting"
my createPrintPreset(autoPreset)
set printSet to printer preset autoPreset
set activeFilename to name of active document
--set activeFilename to my trim_text(activeFilename, ".indd", "end") -- start or end
set psOutputFolder to (path to desktop folder) as string -- & "Distilled PDFs:" as string
set psPath to psOutputFolder & activeFilename & ".ps"
set print file of printSet to psPath
print active document using printSet without print dialog
delete printer preset autoPreset
save active document
close active document
end tell
return {activeFilename, psOutputFolder}
end printPS
-- *******************************************************************************
-- *******************************************************************************
on createPrintPreset(presetName)
-- Automatically creates Print Preset if it's not there
tell application "Adobe InDesign CS3"
if printer preset presetName exists then
-- do nothing
else
make new printer preset with properties {name:presetName, printer:postscript file, PPD:"AdobePDF 8.0", reverse order:false, print spreads:false, print master pages:false, sequence:all, print blank pages:false, print nonprinting:false, paper size:custom, paper height:auto, paper width:auto, print page orientation:portrait, page position:centered, paper gap:0, paper offset:0, paper transverse:false, scale height:100, scale width:100, scale mode:scale width height, scale proportional:true, thumbnails:false, tile:false, all printer marks:false, use document bleed to print:true, bleed marks:false, color bars:false, crop marks:false, include slug to print:false, mark line weight:p25pt, mark offset:0.6, mark type:default, page information marks:false, registration marks:false, color output:composite CMYK, flip:none, send image data:all image data, font downloading:complete, download PPD fonts:true, data format:binary, PostScript level:level 3, source space:use document, OPI image replacement:false, omit bitmaps:false, omit EPS:false, omit PDF:false, flattener preset name:"[High Resolution]", ignore spread overrides:false}
end if
end tell
end createPrintPreset