I have this applescript that I have been using with no problems, using OSX 10.5 Leopard and Quark 7. I recently upgraded to Quark 8 and Snow Leopard. Since Quark 7 didn’t run very good in Snow Leopard. Now my script doesn’t work, I think it is crashing at the Quark step. If anyone can take a look thank you in advance.
set thePrinter to "Printergy"
tell application "Printer Setup Utility"
set current printer to first printer whose name is thePrinter
end tell
tell application "Finder"
set issue_number to text returned of (display dialog "Enter the Issue Number" default answer "00") as string
set region_list to {"National", "Arizona", "California COMMON", "California LA", "California OC", "California SD", "California BigBook", "Chicago", "Colorado", "Florida", "North West", "Texas COMMON", "Texas Austin", "Texas Dallas", "Texas Houston", "Texas BigBook"}
set region_code to choose from list region_list with prompt "Choose a Region:"
if region_code = {"National"} then
set region_code to "NAT"
end if
if region_code = {"Arizona"} then
set region_code to "AZ"
end if
if region_code = {"California COMMON"} then
set region_code to "CAL_COM"
end if
if region_code = {"California LA"} then
set region_code to "LA"
end if
if region_code = {"California OC"} then
set region_code to "OC"
end if
if region_code = {"California SD"} then
set region_code to "SD"
end if
if region_code = {"California BigBook"} then
set region_code to "CAL"
end if
if region_code = {"Chicago"} then
set region_code to "CH"
end if
if region_code = {"Colorado"} then
set region_code to "CO"
end if
if region_code = {"Florida"} then
set region_code to "FL"
end if
if region_code = {"North West"} then
set region_code to "PNW"
end if
if region_code = {"Texas COMMON"} then
set region_code to "TEX_COM"
end if
if region_code = {"Texas Austin"} then
set region_code to "AUS"
end if
if region_code = {"Texas Dallas"} then
set region_code to "DAL"
end if
if region_code = {"Texas Houston"} then
set region_code to "HOU"
end if
if region_code = {"Texas BigBook"} then
set region_code to "TEX"
end if
end tell
tell application "QuarkXPress"
activate
set missingImages to {}
set documentImages to properties of every image of document 1 as list
try
repeat with documentImage in documentImages
if missing of documentImage is true then
set missingImage to file path of documentImage as text
set missingImage to my getName(missingImage)
set end of missingImages to missingImage
end if
end repeat
end try
end tell
set alertIcon to 0
if missingImages is not {} then
set text item delimiters to return
set missingImages to text items of missingImages as string
set text item delimiters to ""
set missingImages to "These images are missing:" & return & missingImages
set alertIcon to 2
else
set missingImages to "All the images are linked"
end if
if alertIcon is 2 then
tell application "QuarkXPress" to display dialog missingImages & return & return & "Create PDFs Anyway?" with icon stop buttons {"Cancel", "YES"} default button {"Cancel"}
end if
on getName(missingImage)
set text item delimiters to ":"
set missingImage to text item -1 of missingImage
set text item delimiters to ""
return missingImage
end getName
tell application "QuarkXPress"
tell front document
set file_name to name as text
set thePages to name of every page
set PagesToPrint to choose from list thePages with prompt "Choose Pages to PDF:" with multiple selections allowed
repeat with apage in PagesToPrint
count characters of apage as text
if length of apage is 1 then
set new_number to text -3 thru -1 of ("00" & apage)
end if
if length of apage is 2 then
set new_number to text -3 thru -1 of ("0" & apage)
end if
if length of apage is 3 then
set new_number to apage
end if
if length of apage is 4 then
set new_number to apage
end if
set pagewidth to 11
set pageheight to 13
set boxOrigin to {"-.4475\"", "7.5\"", "1\"", "9.75\""}
make new text box at page apage with properties {name:"Text 1", bounds:boxOrigin, frame:{color:color spec "Black", gap color:null, gap shade:"0%", shade:"0%", style:solid line, width:"0 pt"}, vertical justification:top justified, runaround:none runaround}
set properties of story 1 of text box "Text 1" to {font:"Helvetica", size:"14 pt"}
set story 1 of text box "Text 1" to (region_code & "_LX" & issue_number & "_" & new_number) as string
tell print setup
set printer type to "Prinergy Refiner"
set paper size to "custom"
set paper width to pagewidth
set paper height to pageheight
set paper offset to 0
set page gap to 0
set reduce or enlarge to "100%"
set fit in area to false
set page position to center position
set orientation to portrait
set separation to false
set print spreads to false
set include blank pages to false
set print thumbnails to false
set back to front to false
set page sequence to all pages
set registration marks offset to "12"
set bleed to "0.5"
set tiling to off
set data format to binary data
set output setup to «constant PCLECACC»
set print quality to normal
set resolution to 2400
set halftone screen to 400
end tell
set file_path to path to the desktop as text
set PSFILE_PATH to (file_path & region_code & "_LX" & issue_number & "_" & new_number & ".ps") as text
print (page apage) PostScript file PSFILE_PATH
delete text box "Text 1"
tell application "Finder"
set FILE_CHECK to false
repeat until FILE_CHECK is true
if exists alias PSFILE_PATH then set FILE_CHECK to true
end repeat
delay 5
end tell
tell application "Acrobat Distiller"
Distill sourcePath POSIX path of PSFILE_PATH adobePDFSettingsPath "/Library/Application Support/Adobe PDF/Settings/Creo PDF Pages.joboptions" destinationPath POSIX path of (path to home folder from user domain) & "Desktop/LUXE_out"
end tell
tell application "Finder"
set trash_file to PSFILE_PATH
delete file trash_file
end tell
end repeat
tell application "QuarkXPress"
activate
display dialog "Your PDFs are Done" buttons {"OK"} with icon 1 default button 1
end tell
end tell
set oldPrinter to "CANON-PRO_Print"
tell application "Printer Setup Utility"
set current printer to first printer whose name is oldPrinter
end tell
end tell
Tim