I have gotten the hang of scripting printing with Quark XPress.
My problem seems to be with the Printer Utility.
tell application "Printer Setup Utility"
set current printer to printer "Phaser 5500N"
end tell
But I seem to lose printer settings, like specific trays, number of “pages” per page, etc. when I run my scripts.
Is there a way to preserve them?
Seems like when I print via Applescript, the printer settings revert to the defaults.
If I print the old-fashioned way, thru the dialog, I have no problems.
Now I do notice the printer setup utility has a scripting dictionary, but I need to control printer specific settings. (Like “edge-to-edge” printing–Xerox lets you toggle whether
it prints ink right to the very edge of the paper)
This script shows lp options for the default printer. lpoptions can also set them. Perhaps you could use that (I don’t have a sufficiently sophisticated printer to try).
set Default_Printer to last word of (do shell script "lpstat -d")
do shell script "lpoptions -d " & Default_Printer
Also, does your printer show up in the Printer Setup Utility’s ‘Utility’ window? (only my inkjet does, but not my laserprinter).
I was having a similar problem with Indesign and Applescript - what I did to remedey it was to create a print preset, and then set the print preferences in Indesign to use that preset. You might be able to use the same concept with Quark
PLEASE NOTE* This is not a working script - I just cut the releavant parts of a larger script so you could get the idea.
set myStyles to name of printer presets
set myPrinterStyle to (choose from list myStyles with prompt "Please Choose a Printer Style") as string
tell print preferences
set active printer preset to myPrinterStyle
set printer to postscript file
set print blank pages to true
set page range to (mypage & "-" & mypage) as string
set print file to myPSPathAndName
end tell
print without print dialog
Are you scripting InDesign here:? set myStyles to name of printer presets
set myPrinterStyle to (choose from list myStyles with prompt “Please Choose a Printer Style”) as string
Yes - that whole chunk of code is all indesign specific Applescript - like I said - I was just giving you some ideas about how you may want to do it with Quark
I don’t know about your printer specific options but heres some script that i’ve used. It records the default printer sets up a list of printers to choose from sets the print setup of the quark doc prints then resets the printer back to default. In tell print set up choose the PPD first as in the UI as this controls the choices (defined by driver) not sure if thats what you meant by only default options?
tell application "Printer Setup Utility"
set DefaultPrinter to the current printer
set PrinterList to choose from list ¬
{"Adobe PDF", "DC_3535_DC3535_Print", "DesignJet 5000PS", "Splash 5750 v6.0"} ¬
with prompt "Please choose a printer."
set MyPrinter to the PrinterList as string
set current printer to printer MyPrinter
end tell
--
tell application "QuarkXPress"
activate
tell document 1
tell print setup
-- The line below is to catch a printer who's PPD name differs from it's actual name in Print Utility.
if MyPrinter is "DC_3535_DC3535_Print" then
set printer type to "Xerox DocuColor3535"
else
set printer type to MyPrinter
end if
set PaperSizeList to choose from list ¬
{"SRA3 SEF", "A3 SEF", "A4 SEF", "A4 LEF", "A5 SEF", "A5 LEF"} ¬
with prompt "Please choose a paper size."
set MyPaperSize to the PaperSizeList as string
set paper size to MyPaperSize
set print spreads to false
set fit in area to false
set reduce or enlarge to "100%"
set bleed to 3 as millimeter units
set PortLand to button returned of ¬
(display dialog "Choose orientation" buttons {"Portrait", "Landscape", "Cancel"})
if PortLand is "Portrait" then
set orientation to portrait
end if
if PortLand is "Landscape" then
set orientation to landscape
end if
set page position to center position
set print colors to composite CMYK
set resolution to 2400
set registration marks to centered
set registration marks offset to 8.504
set include blank pages to true
end tell
--
print copies 1 without print dialog
--
end tell
end tell
--
tell application "Printer Setup Utility"
set current printer to DefaultPrinter
end tell
See that’s what I’m saying, I’m not talking about what Quark and InDesign control, I’m talking about the stuff OUTSIDE of them, that are controlled in the drop down menu you get when you click on PRINTER in the “Print” window of either QXP or ID