I’d created a script, for use in Quark, that prints the current doc to a postscript file. I thought I’d reduce the original process down to the selection of a script that does it all for you.
I’d incorporated some code, that I’d found somewhere else, to check if any elements are missing before printing, be they fonts or images. If there is something missing a dialog pops up.
Here’s the code:-
set ps_folder to "PATH TO FOLDER:postscripts:"
tell application "QuarkXPress"
set missing_pics to false
set missing_fonts to false
tell document 1
repeat with i from 1 to (count images)
if (image i's missing is true) or (image i's modified is true) then
set missing_pics to true
exit repeat
end if
set theFonts to (get font list)
repeat with thisFont in theFonts
if (item 2 of (thisFont as list) as real) < 0 then set missing_fonts to true
end repeat
end repeat
end tell
if missing_pics or missing_fonts then
display dialog "There is either a missing picture or font or both!" with icon stop buttons {"OK"} default button {"OK"}
else
repeat with i from 1 to count of project
tell project i
set ProjectName to name
if (count of layout space) = 1 then
set name of layout space 1 to ProjectName
end if
end tell
end repeat
-- PRINT THE DOCUMENT
end if
end tell
The script works fine apart from one slight niggle, it’s probably a little too keen. The script checks for missing items on the master pages which don’t really come into play when printing.
Do I need to check each page to see whether or not it’s a master page or is there someway I can tell the loop below to ignore master pages?
tell document 1
repeat with i from 1 to (count images)
if (image i's missing is true) or (image i's modified is true) then
set missing_pics to true
exit repeat
end if
set theFonts to (get font list)
repeat with thisFont in theFonts
if (item 2 of (thisFont as list) as real) < 0 then set missing_fonts to true
end repeat
end repeat
end tell
I just looked at the properties of a picture box on page 1 as opposed to one on the master page, and the only thing I can see is that any picture box on the master page is “Picture box 0” even if there are more than one. Maybe you can put a reference to the picture box of the image to add a condition “and picture box x is greater than 0” so it would ignore those. It’s not immediately obvious how you would do that as you are looking at the “images” of the document as opposed to repeating through all the picture boxes. Can you reference the picture box of an image? I haven’t tried that before. You’ll have to experiment but maybe that can point you in the right direction.
Incidentially, I use this little script all the time to figure out how to reference things in Quark. If you have a document open in Quark and select it, you can run this script and see all the properties of the box:
tell application "QuarkXPress"
tell front document
get properties of current box
end tell
end tell
Model: G5 Tower (not Intel) - Script Editor ver 2.1.1
AppleScript: Tiger
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
Nick, just check pics for modified if a pic is missing then it is also modified so you only need search for the one property. not sur about the master pages i will have a quick look. Heres 2 things I use in quark
set MissMod to count (every image whose modified is true)
if MissMod > 0 then
set Warning1 to display dialog "Warning you have " & MissMod & ¬
" missing or modified images!!!" buttons {"Cancel", "Print"} default button 1
if button returned of Warning1 is "Print" then
end if
end if
--
set SpotSpec to count (every color spec whose separation is false)
if SpotSpec > 0 then
set Warning2 to display dialog "Warning you have " & SpotSpec & ¬
" unseparated colours in your doc!!!" buttons {"Cancel", "Print"} default button 1
if button returned of Warning2 is "Print" then
end if
end if
I think I’ll try repeating through all the picture boxes. I’ve got another script for doing a find and replace on pictures and text, maybe I can utilize part of that.
Thanks for the code, I think that’s going to come in very useful.
I have auto activation so missing fonts is not an issue i’ve dealt with. The snippits just offer the user a bail out via the dialogs or continute at own risk. The colour thing is because there is no option for DeviceN through script tut tut quark an oversight!!! The user should go back through the UI and set this in Output.