Quark to Postscript for PDF'ing Purposes

I though I’d share this applet. I combined a couple of codes to come up with this applet that works great. You would obviously just change the file path to the path of your choosing then just select the same destination when prompted.


-- 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 "QuarkXPress"
		open this_item use doc prefs yes remap fonts no do auto picture import yes
		--open this_item use doc prefs yes remap fonts ask do auto picture import yes
		tell application "System Events"
			keystroke "." using {command down}
		end tell
		delay 11
		tell document 1
			set DocName to the name
		end tell
		tell print setup of document 1
			set printer type to "AdobePDF 8.0"
			set paper size to "Custom"
			set paper width to "7.937"
			set orientation to portrait
			set page position to center horizontal
			set print spreads to false
			set reduce or enlarge to "100%"
		end tell
		tell document DocName
			set fp to "Macintosh HD:Users:Ivietx2250:Desktop:POSTSCRIPT FILES:In:"
			set fileName to fp & DocName & ".ps" as string
			--set printfilename to myFolder & fileName --myFolder is a pre-defined destination alias as a global variable
			print PostScript file fileName
			--display dialog "success"
		end tell
		close document DocName saving no
	end tell
end process_item