QuarkXPress to Postscript

I’m new to Applecript and i’m looking for a script to generate a postscript file from the document that is open at that moment.
The PS file is used to create a PDF file
I’ve found several scripts, but none works for me. :frowning:
the script will be used on macos 10.3.x and 10.4.x

need the sript with the folowing settings
print blank pages
registration ONN + offset 5 mm
paper size: document size+20 mm
page positioning: centre
print colors: DeviceN
resolution: 2400
halftoning: printer
full resolution tiff output
bleeds: 5mm
OPI: off

destination would be something like: HD:users:me:desktop:pdf:in

This has been working for me for quite some time now. For each page as PS numbered.

tell application "QuarkXPress"
	set docName to name of document 1
	set docName to text 1 thru 8 of docName
	tell document 1
		set DestFolder to "Marks-G5:Users:marklarsen:Desktop:Press PDF's:In:" as text
		set MyDocWidth to ((width of bounds of current page) as millimeter units) as real
		set MyDocHeight to ((height of bounds of current page) as millimeter units) as real
		tell print setup
			set printer type to "Adobe PDF"
			set paper size to "Custom"
			set print spreads to false
			set fit in area to false
			set reduce or enlarge to "100%"
			set paper width to (MyDocWidth + 20) as millimeter units
			set paper height to (MyDocHeight + 20) as millimeter units
			set bleed to 5 as millimeter units
			set orientation to portrait
			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 14.173
			set include blank pages to true
		end tell
		try
			set curPage to page number of current page
			set pageCnt to count of pages
			repeat with i from 1 to count of pages
				tell page i
					set fileNum to ""
					repeat until (length of (fileNum as text)) = (length of (pageCnt as text))
						if fileNum = "" then
							set fileNum to i
						else
							set fileNum to "0" & fileNum
						end if
					end repeat
					set filePath to DestFolder & docName & "_Page_" & fileNum & ".ps"
					print PostScript file filePath
				end tell
				delay 10
			end repeat
		end try
	end tell
end tell

The same again for whole doc just cut out the repeat pages loop like this:

tell application "QuarkXPress"
	set docName to name of document 1
	set docName to text 1 thru 8 of docName
	tell document 1
		set DestFolder to "Marks-G5:Users:marklarsen:Desktop:Press PDF's:In:" as text
		set MyDocWidth to ((width of bounds of current page) as millimeter units) as real
		set MyDocHeight to ((height of bounds of current page) as millimeter units) as real
		tell print setup
			set printer type to "Adobe PDF"
			set paper size to "Custom"
			set print spreads to false
			set fit in area to false
			set reduce or enlarge to "100%"
			set paper width to (MyDocWidth + 20) as millimeter units
			set paper height to (MyDocHeight + 20) as millimeter units
			set bleed to 5 as millimeter units
			set orientation to portrait
			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 14.173
			set include blank pages to true
		end tell
		set filePath to DestFolder & docName & ".ps"
		print PostScript file filePath
	end tell
end tell

this is OK up to X.3.9 after that you will need Quarks XT to fix the broken print in tiger. Sorry can’t remember the link for that. Use line 3 to set how much of the original doc’s name you want to keep. If you don’t use OPI with Quark its better to turn the XTension OFF its not very safe anyhow. No DeviceN options.

Forgot the option for PS files as quark spreads. This one is only set up to deal with spreads of the same amount of pages each.

tell application "QuarkXPress"
	set docName to name of document 1
	set docName to text 1 thru 8 of docName
	tell document 1
		set DestFolder to "Marks-G5:Users:marklarsen:Desktop:Press PDF's:In:" as text
		set MyPageWidth to ((width of bounds of current page) as millimeter units) as real
		set MyPageHeight to ((height of bounds of current page) as millimeter units) as real
		set SpreadPages to count of pages of spread 1
		set MySpreadWidth to MyPageWidth * SpreadPages
		tell print setup
			set printer type to "Adobe PDF"
			set paper size to "Custom"
			set print spreads to true
			set fit in area to false
			set reduce or enlarge to "100%"
			set paper width to (MySpreadWidth + 20) as millimeter units
			set paper height to (MyPageHeight + 20) as millimeter units
			set bleed to 5 as millimeter units
			set orientation to portrait
			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 14.173
			set include blank pages to true
		end tell
		set filePath to DestFolder & docName & ".ps"
		print PostScript file filePath
	end tell
end tell