Quark /BatchPrint/ with print style?

Here’s a doozy.
I’m working on a little script for our main production department to help batch print a group of Quark documents using the same print setup properties.
My thought was to just say something like “print using print style X”. But I don’t see any way of referring to print styles specifically. (Only getting a record of properties of “print setup”)
Well, I could hard-code each print style’s properties as a variable, but the list of print styles will grow in that department rapidly. Which would make my script invalid in a matter of days.
Would anyone have some kind of workaround? Or a suggestion on a different route? Here’s my current script. As it stands, I have tried to just open one document in advance, set THAT doc’s print style to the one I want for the rest, then I’m trying to set the properties of the FUTURE docs to the same print setup properties of the first doc. Not yet working. The two variables “theStyle” and “style_to_override” end up being the same. It currently ends with getting variable values and doesn’t get to the actual print action so it should be easy to toy with… just so you can see what I’m after… NOTE: I’m using Dialog Director here.

tell application "Desktop Printer Manager" 
	set printerList to name of every desktop printer
end tell

tell application "Finder" 
	set runProc to name of every process 
	if runProc does not contain "QuarkXPress" then 
		display dialog "Quark isn't running! Please launch Quark and retry." buttons {"Cancel"} default button 1 with icon 1 
	else 
		activate 
		set myFolder to (choose folder) 
		set myFiles to ((name of every file in folder myFolder) whose creator type is "XPR3") 
		set myDocs to ((every file in folder myFolder) whose creator type is "XPR3") 
	end if 
end tell
set theDialog to {size:{218, 309}, style:standard palette, closeable:true, name:"mainWIndow ", default item:3, contents:{¬ 
	{class:static text, bounds:{60, 24, 210, 54}, contents:"Choose Printer:", font:{name:"Geneva", size:10}}, ¬ 
	{class:pop up, bounds:{59, 40, 209, 60}, value:1, contents:printerList}, ¬ 
	{class:push button, bounds:{124, 272, 205, 292}, name:"Process"}, ¬ 
	{class:static text, bounds:{4, 44, 54, 69}, contents:"Post Scripter", font:{name:"Geneva", size:10}}, ¬ 
	{class:push button, bounds:{8, 272, 82, 292}, name:"Cancel"}, ¬ 
	{class:icon, bounds:{4, 4, 36, 36}, contents:6002}, ¬ 
	{class:list box, bounds:{8, 112, 208, 262}, value:0, contents:myFiles}, ¬ 
	{class:pop up, bounds:{59, 84, 209, 104}, value:1, contents:{}}, ¬ 
	{class:static text, bounds:{60, 68, 160, 84}, contents:"Choose Print Style:", font:{name:"Geneva", size:10}}}} 
set dVals to dd auto dialog theDialog with fonts {name:"Charcoal", size:12} with grayscale
if item 3 of dVals then 
	set x to item 2 of dVals 
	set myPrinter to (item x of printerList) 
	 tell application "Desktop Printer Manager" 
		set default printer to desktop printer myPrinter 
	end tell 
	 tell application "QuarkXPress?" 
		tell document 1 
			set theStyle to properties of print setup 
		end tell 
		repeat with e in myDocs 
			open e 
			tell document 1 
				set style_to_override to properties of print setup 
				-- set style_to_override to theStyle 
			end tell 
		end repeat 
	end tell
end if

After ‘open e’ put in a ‘delay 1’ and see if that helps
–tet

Well, it’s an interesting problem, but you can just ignore it. Unless I’m missing something, it’s only the first document that you want to read.

I stripped down your script, I hope not too much. Here’s essentially what you want to do:

global theStyleToUse
-- choose file full of QXD whose paper size is letter
tell application "Finder"
	set myDocs to every file in folder (choose folder)
end tell

tell application "QuarkXPress? 4.11"
	tell document 1 -- current doc w/ paper size of tabloid bleed
		set theStyle to properties of print setup
		set theStyleToUse to makeGoodProps(theStyle) of me
		-- check -->
		set nm to name
		log nm
		log paper size of theStyle --> tabloid bleed
		--> end check
	end tell
	repeat with e in myDocs
		open e
		tell document 1
			set properties of print setup to theStyleToUse
			-- check -->
			set style_to_override to properties of print setup
			set nm to name
			log nm
			log paper size of style_to_override --> should be tabloid bleed
			--> end check
		end tell
	end repeat
end tell
beep 2 -- done

to makeGoodProps(tempStyle) -- strip r/o props (there has to be a more elegant way...)
	tell application "QuarkXPress? 4.11"
		set theGoodProps to {adjust horizontal tile:adjust horizontal tile of tempStyle, auto tile overlap:auto tile overlap of tempStyle, back to front:back to front of tempStyle, bleed:bleed of tempStyle, collate:collate of tempStyle, data format:data format of tempStyle, fit in area:fit in area of tempStyle, flip horizontal:flip horizontal of tempStyle, flip vertical:flip vertical of tempStyle, halftone screen:halftone screen of tempStyle, include blank pages:include blank pages of tempStyle, invert image:invert image of tempStyle, orientation:orientation of tempStyle, page gap:page gap of tempStyle, page position:page position of tempStyle, page sequence:page sequence of tempStyle, paper offset:paper offset of tempStyle, paper size:paper size of tempStyle, paper width:paper width of tempStyle, print colors as grays:print colors as grays of tempStyle, print quality:print quality of tempStyle, print spreads:print spreads of tempStyle, print thumbnails:print thumbnails of tempStyle, printer type:printer type of tempStyle, reduce or enlarge:reduce or enlarge of tempStyle, registration marks:registration marks of tempStyle, registration marks offset:registration marks offset of tempStyle, resolution:resolution of tempStyle, separation:separation of tempStyle, tiling:tiling of tempStyle}
	end tell
	return theGoodProps
end makeGoodProps

Luck,

–tet

: Well, it’s an interesting problem, but you can just ignore it.
: Unless I’m missing something, it’s only the first document
: that you want to read.
: I stripped down your script, I hope not too much. Here’s
: essentially what you want to do:

  • Well personally I think Quark could have saved us both alot of hassle and just let me say "print thisFile using print style “Style Blah”.
    But, hey. No use in griping. I’m going to get into your solution and see what I can do. Many thanks for your time and input. I’ll post again once I’ve had a chance.
    Be well. Have a great weekend.
    T.J.

: * Well personally I think Quark could have saved us both alot of
: hassle and just let me say "print thisFile using print
: style “Style Blah”.
Amen!
–tet

: After ‘open e’ put in a ‘delay 1’ and see if that helps
: --tet
Thanks for you reply. This doesn’t seem to change anything.
Anyone else have any suggestions? Is there some kind of coersion I need to do here? It seems like this ought to be pretty simple. But, then again, Quark is quite the standards-bucking beast. grr.

I have a similar problem
I have lots of quark jobs that are autotypeset using applescripts and I need to print them out to pdf files that will can be sent to off site printers.
I have had no luck with print styles at all but I can set the page size with scripts and create the pdfs on the fly now.
Rick