Batch printing in QuarkXPress

Is there a solution to make this thing running on OS 10.4 and QXP 6.5 without crashing Quark?

-- ..............
tell document 1
end tell
-- ..............

It seems that the problem is that Quark don’t tell correctly AppleScript when the printing is done, and a close command during printing causes a crash.
A solution could be inserting a delay between the commands “print” and “close”. But if the delay is short, large documents can’t get printed; if the delay is long, the script’s execution time will increase (the printing is meant to be repeated through several files).


Here’s a script I use to print all the open Quark documents I have open at the time. This seems to work for me. (10.3, Quark 6.5) I’m not sure why yours crashes as mine script is similar to yours.

tell application "QuarkXPress"
	set doclist to every document
	repeat (count doclist) times
		tell front document
			tell print setup
--my printer settings
				set absolute overlap to true
				set auto tile overlap to "18p"
				set back to front to false
				set bleed to "0p"
				set collate to false
				set data format to binary data
				set fit in area to false
				set flip horizontal to false
				set flip vertical to false
				set full res rotated objects to false
				set halftone screen to "71"
				set include blank pages to false
				set invert image to false
				set orientation to portrait
				set page gap to "0p"
				set page position to center position
				set page sequence to all pages
				set paper offset to "0p"
				set printer type to "HP LaserJet 5000 Series"
				set paper size to "Letter"
				set print colors to grayscale
				set print quality to rotate
				set print spreads to false
				set print thumbnails to false
				set reduce or enlarge to "100%"
				set registration marks to off
				set registration marks offset to "0 pt"
				set resolution to 600
				set separation to false
				set tiling to off
			end tell
			close saving yes
		end tell
	end repeat
end tell


Just read on the net that it works on OS prior to 10.4, but not on 10.4…

ok, thanks.

I don’t have 10.4 to test, but I found a post by Adam Bell with these examples…

Would something like this work?

tell application "QuarkXPress"
	set X to file path of front document as Unicode text
	tell front document to print
end tell
set isready to checkready(X)
if isready is equal to true then
	tell application "QuarkXPress"
		tell front document
			close saving no
		end tell
	end tell
	repeat until isready is equal to true
		set isready to checkready(X)
	end repeat
	tell application "QuarkXPress"
		tell front document
			close saving yes
		end tell
	end tell
end if

on checkready(X)
-- Wait for the file to be openable (jj)
		open for access file X -- if this succeeds, the file is not busy.
		close access result
		return true
	on error -- file is busy
		delay 1
		return false
	end try
end checkready

You most likely need and xtension to fix.