This script is designed to create a rectangle on every page in a document, in a layer called “sealer” and filled with an 80% tint of a colour called “sealer”. The rectangle will bleed off 3mm on each edge.
This script works perfectly on single pages. However, when it is run on a document with two or more pages next to each other, even if the spreads are not set up as “facing pages”, it only puts alternate tint panels on the “sealer” layer, the other goes on the default layer. This despite the rectangle properties specifying the same layer throughout.
-- Script to add a sealer to every page in the QuarkXPress document.
-- Creates a new colour called "sealer" with 12% of each of CMYK (same values as V1_Varnish)
-- Creates a new layer called "sealer" to enable sealers to be switched on and off
-- Draws a box 6mm bigger than page, filled with "sealer" colour.
-- Kalessin, 6 July 2006
-- Revision: 4 August 2006
-- Added error checking to detect existing colours and layers
tell application "QuarkXPress Passport"
activate
if not (front document exists) then return -- make sure a document is open
tell document 1
set useLayer to "No"
set useColour to "No"
set sName to "sealer"
if (layer sName exists) then
display dialog "A layer called \"sealer\" already exists. Do you want to use this layer?" buttons {"Yes", "No"} default button 1
if the button returned of the result is "Yes" then
set useLayer to "Yes"
else
return
end if
end if
if (color spec sName exists) then
display dialog "A colour called \"sealer\" already exists. Do you want to use this colour?" buttons {"Yes", "No"} default button 1
if the button returned of the result is "Yes" then
set useColour to "Yes"
else
return
end if
end if
set thePageWidth to the (width of the bounds of page 1 as real)
set thePageHeight to the (height of the bounds of page 1 as real)
set theOldPageOrSpreadRulerChoice to the item spread coords -- keep this value to reset afterwards
set the item spread coords to false -- page co-ordinates, not spread
set theOldRulerOrigin to the page rule origin -- keep this value to reset afterwards
set the page rule origin to {0, 0} -- reset default ruler position
if (useLayer is "No") then
make new layer at beginning with properties {name:"sealer"} -- new layer goes above other layers
end if
if (useColour is "No") then
make new color spec at beginning with properties {name:"sealer", CMYK color value:{7864, 7864, 7864, 7864}} -- CMYK values of 12% each
end if
set allpages to count of every page
repeat with i from 1 to count of pages
try
tell page i
make new generic box at beginning with properties ¬
{bounds:{-3, -3, thePageHeight + 3, thePageWidth + 3}, color:"sealer", layername:"sealer", shade:"80", runaround:none runaround, background trap:overprint} -- includes 3mm bleed all around the page
end tell
on error
-- display dialog "An error occurred." buttons {"OK"} default button 1
end try
end repeat
set the page rule origin to theOldRulerOrigin -- revert to original settings
set the item spread coords to theOldPageOrSpreadRulerChoice -- revert to original settings
end tell
end tell
Hopefully, the fix is something simple and obvious which will leave me looking a little red-faced. However, I’m prepared for the worst… All assistance gratefully received.