QuarkXPress 6.5-Batch Printer Not Collating

This is driving me nuts:

I’ve got a droplet that will bring up a few dialog boxes, asking the user to choose different printing parameters for QuarkXPress files, and then will print the files that were dropped on it using those parameters. However, I can’t get the pages to collate, even though the printer will collate when printing multiple copies manually, and there’s a “collate” boolean available in Quark’s dictionary.

Here’s the code:


global copyNumber
global myOrientation
global useScale
global paperSize
global myReg
global myBleed

on open these_items
	tell application "Finder"
		set selectPrinter to (display dialog ¬
			"Which printer are you going to use?" buttons ¬
			{"Printer 1", "Printer 2"} default button "Printer 1")
		set myPrinter to button returned of selectPrinter
		if myPrinter is "Printer 1" then set myPrinter to "PRINTER-1" as text
		if myPrinter is "Printer 2" then set myPrinter to "PRINTER-2" as text
	end tell
	
	
	ignoring application responses
		tell application "Printer Setup Utility"
			set current printer to printer myPrinter
		end tell
	end ignoring
	
	
	tell application "Finder"
		activate
		set askNumber to (display dialog ¬
			"How many copies do you want to print?" buttons ¬
			{"Cancel", "OK"} default button "OK" default answer "How many copies?")
		set copyNumber to (text returned of askNumber) as integer
		set paperSize to (choose from list {"Letter LEF", "Letter SEF", "Legal", "Tabloid", "12x18"} with prompt "What size media are you printing to?")
		set getOrientation to (display dialog ¬
			"Portrait or landscape?" buttons ¬
			{"Portrait", "Landscape"} default button "Portrait")
		set myOrientation to button returned of getOrientation
		if myOrientation is "Portrait" then set myOrientation to "portrait"
		if myOrientation is "Landscape" then set myOrientation to "landscape"
		set getScale to (display dialog ¬
			"Print at what scale?" buttons ¬
			{"Cancel", "OK"} default button "OK" default answer "100")
		set myScale to (text returned of getScale) as integer
		set useScale to (myScale & "%") as text
		set myBleed to (choose from list {"0", "0.25", "0.5", "0.75", "1", "1.25", "1.5", "1.75", "2", "2.25", "2.5", "2.75", "3"} with prompt "How much bleed?")
		set myBleed to myBleed as number
		set myReg to (choose from list {"off", "centered"} with prompt "Registration marks?")
		set myReg to myReg as text
	end tell
	
	
	
	repeat with i from 1 to the count of these_items
		set this_item to (item i of these_items)
		set the item_info to info for this_item
		
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			my process_item(this_item)
		end if
	end repeat
end open

on process_folder(this_folder)
	set these_items to list folder this_folder without invisibles
	repeat with i from 1 to the count of these_items
		set this_item to alias ((this_folder as text) & (item i of these_items))
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			my process_item(this_item)
		end if
	end repeat
end process_folder



on process_item(this_item)
	tell application "Finder"
		try
			set File_Name to name of file this_item as text
			
		on error
			display dialog "Bad"
		end try
	end tell
	
	tell application "QuarkXPress"
		open this_item use doc prefs «constant KPRFyes »
		tell document 1
			tell print setup
				set printer type to "Splash G3535-DocuColor 3535 PM"
				set paper size to paperSize
				if myOrientation is "landscape" then
					set orientation to landscape
				else if myOrientation is "portrait" then
					set orientation to portrait
				end if
				set page position to center horizontal
				set print spreads to false
				set fit in area to false
				set reduce or enlarge to useScale
				if myReg = "off" then
					set registration marks to off
					if myReg = "centered" then
						set registration marks to centered
					end if
				end if
				set bleed to myBleed
				if copyNumber > 1 then set collate to true
			end tell
		end tell
		print document 1 copies copyNumber
		close document 1 saving no
	end tell
	
end process_item

Lil’ help?!

Are you sure the problem is collation. Is the problem you’re having that Quark quits and gives you an error message saying “Connection is invalid”? That’s what’s happening to me.

More importantly, are you in Tiger or Panther. There is a major bug with Quark and Apple Script directed printing in Tiger.

See this link for more info:

http://www.quark.com/service/forums/viewtopic.php?t=8016

Thanks for asking, harges. I’m in Panther (10.3.9)…the script accomplishes the batch printing, but the pages are not collated. No error messages come up (typically).
I’m pretty much stumped by this one.