Ok, I've been beating my head against my desk long enough, any help would be GREATLY appreciated. The following script worked just fine using Quark 7 but my recent upgrade to Quark 8 broke it (alot) :)
Basically what's going on in we open a QuarkXPress doc, save it off as an eps, do some other stuff... then import the file into a template that will be used for proffing purposes.
-- *****************************
-- SAVE QUARK DOC AS EPS
-- *****************************
tell application "QuarkXPress"
activate
open file (filePath & ":" & fileName) given «class KPRF»:yes, «class RMPF»:no
tell document fileName
set «class visc» to "100%" -- This must be here for image size to be correct, save page uses view scale
end tell
--save page 1 of document fileName in ((filePath & ":" & epsName) as alias) as "EPSF" EPS format Standard EPS EPS data binary EPS OPI include images
save «class page» 1 of document fileName in (filePath & ":" & epsName) as "EPSF" given «class PEPS»:«constant PEPSSEPS», «class DEPS»:«constant DEPSBINE», «class OEPS»:«constant OEPSINCE»
-- save page 1 of document fileName in file (filePath & ":" & epsName) EPS data binary EPS OPI include images
-- save page 1 of document 1 in alias ("Graphics Station J:junk" as string as alias) as "EPSF" EPS format Standard EPS EPS data binary EPS OPI include images
close document fileName saving no
end tell -- application QuarkXPress
----------------------------------------------------------------------------------
//////////////////////////////// much later in the script ////////////////////////////
----------------------------------------------------------------------------------
-- ********************************************
-- OPEN TEMPLATE DOC AND IMPORT EPS FILE
-- ********************************************
open file (ADPATH & ":" & ADFILE) given «class KPRF»:yes, «class RMPF»:no
tell document ADFILE
set «class visc» to «constant VSCLFPWN»
-- Set units to points because image dimensions seem to always be in points
set «class VMEA» to «constant measUPNT»
set «class HMEA» to «constant measUPNT»
--make picture box at beginning with properties {color:"none"}
make «class PICB» at beginning
set boundsBuf to ((bounds of «class page» 1) as list)
-- commenting out because it throws a "can't convert to unicode text" error
--set px0 to my makeNum((item 2 of boundsBuf) as text)
--set py0 to my makeNum((item 1 of boundsBuf) as text)
--set px1 to my makeNum((item 4 of boundsBuf) as text)
--set py1 to my makeNum((item 3 of boundsBuf) as text)
set px0 to ((item 2 of boundsBuf) as number)
set py0 to ((item 1 of boundsBuf) as number)
set px1 to ((item 4 of boundsBuf) as number)
set py1 to ((item 3 of boundsBuf) as number)
set pageWidth to (px1 - px0)
set pageHeight to (py1 - py0)
tell «class page» 1
tell «class PICB» 1
set «class IMAG» 1 to (filePath & ":" & epsName) as alias
-- ********************************************
-- CENTER IMAGE ON PAGE
-- ********************************************
set boundsBuf to bounds of «class IMAG» 1
-- commenting out because it throws a "can't convert to unicode text" error
--set y0 to my makeNum((item 2 of boundsBuf) as text)
--set x0 to my makeNum((item 1 of boundsBuf) as text)
--set y1 to my makeNum((item 4 of boundsBuf) as text)
--set x1 to my makeNum((item 3 of boundsBuf) as text)
set y0 to ((item 2 of boundsBuf) as number)
set x0 to ((item 1 of boundsBuf) as number)
set y1 to ((item 4 of boundsBuf) as number)
set x1 to ((item 3 of boundsBuf) as number)
set imageWidth to (x1 - x0)
set imageHeight to (y1 - y0)
set cx0 to (pageWidth / 2 - imageWidth / 2)
set cy0 to (pageHeight / 2 - imageHeight / 2)
set cx1 to (cx0 + imageWidth)
set cy1 to (cy0 + imageHeight)
set cx0 to ((cx0 as text) & " pt")
set cx1 to ((cx1 as text) & " pt")
set cy0 to ((cy0 as text) & " pt")
set cy1 to ((cy1 as text) & " pt")
--display dialog "cx0=" & cx0 & "cy0=" & cy0 & "cx1=" & cx1 & "cy1=" & cy1
set bounds to {cy0, cx0, cy1, cx1}
end tell -- picture box
-- ********************************************
-- PLACE TEXT BOX WITH PAGE INFO
-- ********************************************
make «class TXTB» at beginning with properties {bounds:{"9.75\"", "0.5\"", "10.375\"", "4.625\""}}
--set propName to "Name Of Property:"
set adNumber to (text items 2 through (length of fileName) of fileName) & "PROOF"
set timeStamp to ((current date) as text)
set stringBuf to "Ad Number: " & adNumber & (ASCII character 13) & ¬
timeStamp & " " & (ASCII character 13) & "Artist: " & usrName
tell text flow 1 of «class TXTB» 1
set contents of it to stringBuf
set font to "Times"
end tell
end tell -- page
end tell -- document ADFILE
end tell -- application QuarkXPress
end repeat --end loop file list
end tell -- application Finder
on error errMsg number errNum
set errMsg to "AdToEPS" & errMsg
tell ASUtils
get errorHandler(errMsg, errNum)
end tell
end try