Help!, Batch pdfing in quark 6, 10.3.4

I’m trying to make a droplet that processes folders of Quark 6 files into single page .PS files , dropping them off in an Acrobat watched folder.

If I drag any number of files to the droplet it will get all the way through the first page of the first document, sometimes the second, write the .PS file and then crash Quark, and return a “connection is not valid” script dialog.

Any thoughts? I’m super new to applescript, it’s probably something simple.

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

set The_Path to choose folder with prompt "Please select the Distiller In folder."

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, The_Path)
	else if (alias of the item_info is false) then
		my process_item(this_item, The_Path)
	end if
end repeat

end open

– this sub-routine processes folders
on process_folder(this_folder, The_Path)
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, The_Path)
else if (alias of the item_info is false) then
my process_item(this_item, The_Path)
end if
end repeat
end process_folder

– this sub-routine prints the files
on process_item(this_item, The_Path)
tell application “Finder”
open item this_item
try set File_Name to name of file this_item as text
on error display dialog “Problem getting file name.”
end try
end tell
tell application “QuarkXPress Passport”
activate
tell print setup of document 1
set printer type to “Adobe PDF Panther”
set paper size to “Custom”
set paper width to “10"”
set orientation to portrait
set page position to center horizontal
set print spreads to false
set reduce or enlarge to “100%”
set registration marks to centered
set bleed to “.125"”

	end tell
	repeat with i from 1 to count of pages of document 1
		set PS_file_path to ((The_Path as string) & File_Name & "_" & i & ".ps") as string
		print page i of document 1 PostScript file PS_file_path
	end repeat
	close document 1 saving no
end tell

end process_item

Your script works fine for me. I teted it using multipage Quarkl files though they were text-only and printed quickly. It’s possible that if you have image-heavy pages, they are taking longer to print than the script will wait for and that’s causing trouble. There are a lot of posts in this forum about building in delays and/or waiting for feedback but I’m not too savy at that stuff.

The other thing I noticed was the name of the PPD you call. What’s “Adobe PDF Panther?” I have a similar PPD but it’s just called Adobe PDF. Did you rename the PPD file or is that something new?

Here are some tweaks that will get the script to batch print a 2-page .ps file without having a predetermined page size (and thanks for posting your code, by the way…I’ve been after a solution to OSX Quark-to-Postscript batching for a while now, and this works swell!) In my scenario, I needed to print a .ps file exactly the size of the layout, no registration or bleed.

The 7-second delay is in case you use any font auto-activation, like I do :

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

set The_Path to choose folder with prompt "Please select the Distiller In folder."

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, The_Path)
	else if (alias of the item_info is false) then
		my process_item(this_item, The_Path)
	end if
end repeat

end open

– this sub-routine processes folders
on process_folder(this_folder, The_Path)
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, The_Path)
else if (alias of the item_info is false) then
my process_item(this_item, The_Path)
end if
end repeat
end process_folder

– this sub-routine prints the files
on process_item(this_item, The_Path)
tell application “Finder”
open item this_item
try
set File_Name to name of file this_item as text
on error
display dialog “Bad”
end try
end tell
tell application “QuarkXPress”
activate
delay 7
set mywidth to the width of the bounds of page 1 of document 1
set myheight to the height of the bounds of page 1 of document 1
tell print setup of document 1
set printer type to “Adobe PDF”
set paper size to “Custom”
set paper width to mywidth as text
set paper height to myheight as text
set orientation to portrait
set page position to center horizontal
set print spreads to false
set reduce or enlarge to “100%”
set registration marks to off
set bleed to “0”

	end tell
	set PS_file_path to ((The_Path as string) & File_Name & ".ps") as string
	print document 1 PostScript file PS_file_path
	close document 1 saving no
end tell

end process_item

Thanks again!