PS creation from quark file

Hi,

I have written an applescript program to create PS file from the currently opened quark document.

This script works well and the PS file is created without any problem. Then the problem occurs, that is, once the PS file creation is completed, the quark application gets quit.

What I want is the quark application should not quit once the PS file is created.

My script is:

-- Set up the front Quark document for printing to postscript file
tell application "QuarkXPress"
	activate
	-- Get the name of your file
	set docName to name of document 1
	tell document 1
		set currentFolder to file path as text
		set docName to name as text
		set AppleScript's text item delimiters to docName
		set currentFolder to currentFolder's text items
		set AppleScript's text item delimiters to ""
		set currentFolder to "" & currentFolder
		set AppleScript's text item delimiters to {""}
		
		set MyDocWidth to ((width of bounds of page 1) as millimeter units) as real
		set MyDocHeight to ((height of bounds of page 1) as millimeter units) as real
		
		tell print setup
			-- Layout
			set separation to false
			set print spreads to false
			set collate to false
			set include blank pages to true
			set print thumbnails to false
			set back to front to false
			set page sequence to all pages
			set registration marks to centered
			set registration marks offset to 12 -- Must be points value
			set tiling to off
			set absolute overlap to false
			
			-- Setup
			set printer type to "Acrobat Distiller"
			set paper size to "Custom" -- This needs to be set before setting the Height & Width
			
			-- Add extra area around page (pdf media box)
			set paper width to (MyDocWidth + 38.1) as millimeter units
			set paper height to (MyDocHeight + 38.1) as millimeter units
			set reduce or enlarge to "100%"
			set fit in area to false
			set page position to center position
			set orientation to portrait
			set paper offset to "0 pt"
			set page gap to "0 pt"
			
			--  Output Tab
			set print colors to grayscale
			set resolution to "600"
			set halftone screen to "133"
			
			-- Options (No Full resolution Tiff or Overprint EPS options)
			set flip horizontal to false
			set flip vertical to false
			set invert image to false
			set print quality to normal
			set data format to binary data
			set full res rotated objects to false
			
			-- Bleed
			--set bleed to "9pt"
		end tell
		
		tell custom bleeds setup 1
			set EPS bleed type to asymmetric
			set EPS bleed to "9pt"
			set bleed type to asymmetric
			set bleed to "9pt"
			set bleed clipping to true
		end tell
		
		-- Check the images before printing
		set MissMod to count (every image whose modified is true)
		if MissMod > 0 then
			set Warning1 to display dialog "Warning you have " & MissMod & ¬
				" missing or" & return & "modified image(s) in your document!" buttons {"Cancel", "Print"} default button 1
			if button returned of Warning1 is "Print" then
			end if
		end if
		
		-- Check the colours used before printing
		set SpotSpec to count (every color spec whose separation is false)
		if SpotSpec > 0 then
			set Warning2 to display dialog "Warning you have " & SpotSpec & ¬
				" un-separated colour(s)" & return & "in your document!" buttons {"Cancel", "Print"} default button 1
			if button returned of Warning2 is "Print" then
			end if
		end if
		set filepath to currentFolder & docName & ".ps"
		print PostScript file filepath
	end tell
	
end tell

-- Allow postscript file to finish creating
delay 20

display dialog "Completed."

Could you please look into this and help me to resolve this.

Thanks,
Gopal

Very odd that Quark would quit when the script completes. I tried your script on my install of Quark (version 7.3) and it did not quit when the script finished. Does Quark quit normally or does it report that it quit unexpectedly? I used to have lots of problems with Quark 4.11 when trying to script print setup properties, and it’d either crash (quit unexpectedly) or freeze and have to be force quit.

I did have to change two lines in your script in order for it to run, tho.

–set printer type to “Acrobat Distiller”

I had to use

–set printer type to “AdobePDF 8.0”

and the line

–set print colors to grayscale

would not compile/run properly, as ‘grayscale’ was not recognized as a ‘print colors’ property, it showed up as a variable. Maybe the cause?