Quark print script works in 9 but not X

This script works fine on OS9 but hangs on the print command in OSX
Any Ideas

set docname to name of front document of application "QuarkXPress™"
set char_count to count the characters of docname
set shortName to ((characters 1 thru (char_count - 4) of docname) as text) --shortcount
set thepath to (choose folder) as text --"Macintosh HD:Desktop Folder:PDFS:In:" as text --

tell application "QuarkXPress™"
	--activate
	
	tell document 1
		tell print setup
			-- put the print setings here
			set paper width to 9.375
			--set printer description to "prinergy Refiner"
			set registration marks to centered
			set registration marks offset to 12
			set data format to binary data
			set resolution to 2400
			set frequency to 100
			set page position to left position
			
		end tell
		set pgcount to count pages
		set pg to name of page 1
		repeat with i from 1 to pgcount
			set pg to name of page i
			set i to pg
			print (page i) PostScript file thepath & shortName & "pg" & i & ".ps"
		end repeat
	end tell
end tell

Hi Joe:
Did you ever solve this problem? I’m having the same trouble. It hangs up on print. If I noodle with a “with timeout” bracket, sometime I can get it to not hangup but there doesn’t seem to be any rhyme or reason to it.

yeah

i did it the long way :cry:

let me know if you get it fixed

It doesn’t help that the the Forms on the Quark site are not up now. I’ll post again inf I figure it out.

Hi :slight_smile:
I think that this instruction cannot work under MacOsX…

print (page i) PostScript file thepath & shortName & "pg" & i & ".ps" 

It seems to me that OSX cannot compose a path with a text.
I think that it is necessary to create the file before and to pass it like parameter as alias… for exemple :

tell application "Finder" to set NewFile to ¬
	make file at (folder thepath) with properties ¬
		{name:"" & shortName & "pg" & i & ".ps"}
print (page i) PostScript file (NewFile as alias)

I am not completely sure, but I think (I hope) that can work…
:wink:

I’m also looking for an answer to this one. The script at top is almost identical to what I was trying to create(… so I pitched mine and adapted this one to my print specs), but I too am getting the AppleEvent time out on the print line.

print (page i) PostScript file thepath & shortName & “pg” & i & “.ps”

I’m doing a lot of searches here on the site, but am not finding an answer that works yet. Can someone direct me please?

(OSX, Quark 4.11)
JA

This script below seems to work now. I’m not sure why it was hanging up before and is working now. It prints to a printer, not to a PS file if that’s what you’re looking for – though the alteration from printer to PS should be pretty easy (unless I’m missing the whole point of this thread which is possible).

It should be pretty self explanatory. There are comments in the body that explain what the script does. You’ll have to hard-code in any of the print setup properties. I have some samples in there. Hope this helps.

I have it working on Macs running OS 10.2 with Quark 6. I’ve been using it with Quark Passport but it should work with XPress as well.

-------BEGIN SCRIPT-----------

– This droplet processes both files or folders of files dropped onto the applet
on open these_items

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

– this sub-routine processes folders
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

– this sub-routine prints the files
on process_item(this_item)
tell application “Finder”
open item this_item
end tell
tell application “QuarkXPress Passport”
activate
tell print setup of document 1
set orientation to landscape
set page position to center position
set print colors to black and white
set print spreads to true
set printer type to “GCC Elite XL 20/600”
set reduce or enlarge to “100%”
set registration marks to centered
end tell

print document 1
close document 1 saving no

end tell

end process_item

----------END SCRIPT-----------

sorry, but it seems to be printing to the PS file that is the problem. I’m trying it with a timeout right now, but it just hangs and spins at the print line.

The first part of your script looks interesting and worth gleaning. Thanks for the input!

JA

Hmm. I was having the same hang problem sending to printers. I don’t know how I corrected it but I’ll try rewriting the script to save as PS files. There’s now way that you know of to script Quark’s Export as PDF function, is there. I mean, we’re stuck using Print PostScript file, huh.

More later.

Jageo:
I tried your script and it works fine with the exception of the print setup commands. I “commented out” those lines and the script works perfectly. One or more of the print setup commands seems to generate an error message. I doesn’t hang up – I get an AS error that it can’t set the paper width. At any rate, the main part of the script works.

I know that’s not what you want to hear. I’m using OS 10.3 and Quark XPress Passport 6.0 so maybe something has changed.

I’m pretty sure that the naming problem (path from text) mentioned by someone in an earlier reply is not a problem. It certainly isn’t causing a problem with my configuration.

Sorry I can’t be of more help.

well… there’s definitely something i’m missing here.
To put it simply, without any frills… the script below times out. Anyone know why??
(MacOS10.2.8, Quark4.11)

set thepath to (choose folder) as text
tell application “QuarkXPress™ 4.11”
print (page 1) PostScript file thepath & “pg” & 1 & “.ps”
end tell

Maybe next i’ll try restarting in system 9 and trying it there… i’m quite anxious to make this work.
I am still very happy to investigate your “processing folders and files” code. Thanks again for that.
JA

trying in OS 9 will work only if you boot into it

that is what i ended up doing when i used it (althogh next time i can’t my new box will not start up in OS 9)

There has to be a way though, to make it work in OSX

Not sure what is different but this worked on OS 10.3




set docname to name of front document of application "QuarkXPress"
set char_count to count the characters of docname
set shortName to ((characters 1 thru (char_count - 4) of docname) as text) --shortcount
set thepath to (choose folder) as text --"Macintosh HD:Desktop Folder:PDFS:In:" as text --


tell application "QuarkXPress"
	--activate
	tell document 1
		tell print setup
			-- put the print setings here
			--set paper width to 9.375
			---set printer description to "prinergy Refiner"
			set registration marks to centered
			set registration marks offset to 12
			set data format to binary data
			set resolution to 2400
			--set frequency to 100
			set page position to left position
		end tell
		
		set pgcount to count pages
		set pg to name of page 1
		repeat with i from 1 to pgcount
			set pg to name of page i
			set i to pg
			print (page i) PostScript file thepath & shortName & "pg" & i & ".ps"
		end repeat
	end tell
end tell

thanks joe for coming back to this thread. I was hoping to find out what your cryptic post “I did it the long way” meant. Starting up in 9 is an option right now since we’re still using quark 4.11, but the point of changing the machines over to 10 was to get us ready to go over to quark 6.
But since that will still be a little while i guess I can make do…

Or get 10.3, i guess, right?
What version of quark do you use?

JA

when i said i did it the long way i meant booting up in os 9 with quark 5 (4.1 should work as well)
but since than i have upgraded to a firewire 800 (silver door G4) which cannot boot into os 9 i have also upgraded to Quark 6.0

but i believe my most recent post will work with quark 6.0 in os 10.3

If you would like to have your print command to run under the Classic Environment, just save your script as a Classic Application.
The print command has to be executed in this way or it doesn’t work. Running the script as a Classic Application also avoid all the problems you could have when getting/setting some print setup values.
I hope this could help
Cheers
Luca

very good to know thanks Luca
i will have to give that a try

Although i have everything working with quark 6.0 and OS 10.3 it is always good to know that there is a workable option for other than quark 6

thanks again

Hey Joe:
Glad you finally got your thing to work.

I’m still frustrated with mine. It works fine to a printer or to PS files to Distill but Quark just doesn’t allow you to set paper width. It looks from Quarls web site like this has been true since Quark 4. Their clever workaround involves using Quick Keys, not exactly and Apple Script solution (http://www.quark.com/service/desktop/support/techinfo/article.cfm?idx=802).

We’re tying to make PDFs in a scripted way just like Quark does with the “Export Layout to PDF” function under the file menu. If you use that, and check off registration marks it sizes the PDF page to the document size plus exatly that space necessary to add in the registration and crop marks. That’s what we want to do but it seems that there’s no way to script the “Export Layout to PDF” function and you can create PS files and distill later because you can’t set the page width – what you get if you don’t spec the width and heigh in your AS is the default width and height the PPD assigns for Custom Page size, which is 8" wide by Automatic high.

Very frustrating.

you might want to try to create a print style or edit the default print sytle to match the page width you need

i think that is how i was able to do it

You can’t script print styles can you?

Anyway, I just found a workaround. For some reason Quark won’t let you set the page width when you have the “Acrobat Distiller” selected as a printer type. However, if you set the printer type to “Generic PDF” you can set the page width.

So, this will work:

tell application "QuarkXPress Passport"
	activate
	tell print setup of document 1
		set printer type to "Generic PDF"
		set paper size to "Custom"
		set paper width to "4.27""
		end tell
	print document 1 PostScript file {(The_Path as string) & File_Name & ".ps"}
end tell

But this won’t:

tell application "QuarkXPress Passport"
	activate
	tell print setup of document 1
		set printer type to "Acrobat Distiller"
		set paper size to "Custom"
		set paper width to "4.27""
		end tell
	print document 1 PostScript file {(The_Path as string) & File_Name & ".ps"}
end tell

Go figure. It makes no sense to me. But it works. The only thinnk that worries me is that I don’t know what the other differences are between the Generic PDF and Acrobat Distiller PPDs. It seems to make Post Script files that distill into the same PDFs but I don’t really know for sure that they are exactly the same.