Changing all of the print items in 10.4 to print to specific printers

Hello all - can anyone help with scripting that will change: 1.) Quark 6 “print style” to a specific one
2.) change 10.4 printer 3.) change page setup settings

I have been trying to get this done in Quickeys X3 but to no avail. What I am hoping to accomplish is an applescript that I can trigger from within a Quickey.

Thanks
Jim Robidoux
Business Card Express
Derry, NH

Hi Jim

Point number 2 is this the printer in quark or we talking printer set up utility on the operating system?

Bit more info needed? (for everthing)

All of the changes are in Quark 6.5 from the “Print” menu item. The OS-X printer gets changed by the Quickey so it is not a problem. Hope this helps. I found some other posts that reference the problem but am having trouble on the dictionary for Quark to determine the syntax for the “Print Style” and whether or not Applescript can change the “Page Setup” settings needed from within Quark?

Here’s a Quark menu script that I have to get you started. You will have to fill in your printer name and PPD name. It asks for a left or right printer, which in my case are two printers of the same type. Some other coding would be required to make it change the PPD for a totally different printer. Or, you could just save a different version of this for each printer you might have and delete out the printer choice. This prints with registration and automatically picks the page size and orientation, and it automatically turns tiling on if it doesn’t fit.

Anyway, save this as a script (not an application) from ScriptEditor and put the file in your Applications/Quark/Scripts folder. It will then show up in the applescript menu in Quark so it would be easy to create a keyboard shortcut (actually you can do it in the keyboard preferences without using an additional program like QuickKeys). This also saves the previous settings so if you are printing a bunch of files in a row with the same setup it makes it go quicker.

I stripped out a bunch of things that are specific to what I use so hopefully I didn’t introduce any errors. This should at least get you started:

property Printer_left : "Name of Left printer in Printer Setup Utility"
property Printer_right : "Name of Right printer in Printer Setup Utility"
property LeftOrRight : ""
property InputNum : ""
property NumCopies : ""

set PathToDesktop to path to the desktop as text

if LeftOrRight = "" or InputNum = "" then
	try
		set LeftOrRight to the button returned of (display dialog "Which color printer?" buttons {"Left", "Right", "Cancel"} default button "Right")
	on error
		return
	end try
	set InputNum to the button returned of (display dialog "How many copies?" buttons {"1", "2", "3"} default button "1")
	set NumCopies to InputNum as real
else
	try
		set ChangeInputQuery to the button returned of (display dialog ("Printer: " & LeftOrRight & return & "Number of copies: " & InputNum & return & return & "Continue with these settings?") buttons {"OK", "Change", "Cancel"} default button "OK")
	on error
		return
	end try
	if ChangeInputQuery = "Change" then
		try
			set LeftOrRight to the button returned of (display dialog "Which color printer?" buttons {"Left", "Right", "Cancel"} default button "Right")
		on error
			return
		end try
		set InputNum to the button returned of (display dialog "How many copies?" buttons {"1", "2", "3"} default button "1")
		set NumCopies to InputNum as real
	end if
end if

tell application "Printer Setup Utility"
	if LeftOrRight is "Left" then
			set current printer to printer Printer_left
	else
			set current printer to printer Printer_right
	end if
end tell

tell application "QuarkXPress"
	activate
	if not (exists document 1) then
		try
			display dialog "No document open!" buttons "Cancel" default button "Cancel"
		on error
			return
		end try
	end if
	--Print to Color Printer
	tell custom bleeds setup 1 of document 1
		set bleed type to asymmetric
		set bleed to {"0.125\"", "0.125\"", "0.125\"", "0.125\""}
		set bleed clipping to false
	end tell
	display dialog ("Printing to the " & LeftOrRight & " color printer." & return & "Number of copies: " & InputNum) buttons " " giving up after 1
	tell front document
		set DocWidth to the page width of it as real
		set DocHeight to the page height of it as real
		tell print setup
			set printer type to "YourPrinterPPDName"
			set registration marks to centered
			set separation to false
			set tiling to off
			if DocWidth is greater than DocHeight then
					set orientation to landscape
					if DocWidth is greater than 10.75 or DocHeight is greater than 8.25 then
						set paper size to "Tabloid"
						if DocWidth is greater than 16.75 or DocHeight is greater than 10.75 then
							set tiling to automatic
							if DocHeight is greater than 10.75 then
								set orientation to portrait
								set auto tile overlap to "1.5\""
							else
								set orientation to landscape
								set auto tile overlap to "6.0\""
							end if
						end if
					else
						set paper size to "Letter"
					end if
				else
					set orientation to portrait
					if DocWidth is greater than 8.25 or DocHeight is greater than 10.75 then
						set paper size to "Tabloid"
						if DocWidth is greater than 8.25 and DocHeight is less than 10.755 then
							set orientation to landscape
						end if
						if (DocWidth is greater than 10.75 and DocHeight is greater than 10.754) or DocHeight is greater than 16.75 then
							set tiling to automatic
							set auto tile overlap to "6.0\""
						end if
					else
						set paper size to "Letter"
					end if
				end if
			set page position to left position
			set paper offset to 0
			set page gap to 0
			set reduce or enlarge to 100
			set fit in area to false
			set include blank pages to false
			set print thumbnails to false
			set print colors as grays to false
			set back to front to false
			set print spreads to false
			set page sequence to all pages
			set flip horizontal to false
			set flip vertical to false
			set invert image to false
			set print quality to normal
			set print colors to composite CMYK
			set data format to binary data
			set collate to false
		end tell
	end tell
	print front document copies NumCopies
end tell

beep 1
display dialog ("Finished!") buttons " " giving up after 1

Model: G5 Tower (not Intel) - Script Editor ver 2.1.1
AppleScript: Tiger
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Thanks - I’ll have at it as to how to modify to my setup.
Jim

Oh, to answer one of your original questions: I have not ever seen a way to select a Print Style in AppleScript. I think it forces you to set up all the settings directly as in the above script.

Heres another alternative that i’ve used that makes use of list returns for things like paper size where there are more than 3 options and choice of prinrters. I switches from default to your choice then back to default. It may be of use to you.

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

opps pressed submit instead of applescript button. d’oh