This script takes every open quark document and prints postscript files of those documents to my desktop. It repeats, saving and closing documents before moving on to the next open document. It works fine, except on the next to last document open! It always skips over the next to last document, simply closing it without generating a postscript file. Does anyone have any ideas about what is causing this? Any input would be greatly appreciated, as this is extremely frustating. I have posted my script below.
tell application "QuarkXPress"
activate
repeat
try
if (count documents) is not equal to 0 then
set theName to name of front document
set thePSfile to ((path to desktop) & theName & ".ps") as string
print document 1 PostScript file thePSfile without print dialog
save document 1
close document 1
tell front document
activate
end tell
else if (count documents) = 0 then
exit repeat
end if
end try
end repeat
end tell
Model: Power Mac G5
Browser: Safari 419.3
Operating System: Mac OS X (10.4)