I have a script to create a 'guide' box on a non-printing layer. I select the box and run the script and a magenta outlined box appears to show me the area in which items can appear.
However, if my selected box is on page 2, the new box appears on page 2 until the command:
move picture box "NEW" to beginning of layer "GUIDES"
- at which point if moves to page 1
How can I persuade my new picture box to stay on the page where it was created? Here is the script. Make a 2 page Quark doc, draw a picture box on page 2, keep it selected, then run the script. (My measurements are in millimetres, in case that causes problems...)
set layer_exists to "NO"
tell document 1 of application "QuarkXPress"
set item spread coords to true
set my_box to object reference of selection
set the_props to properties of my_box
tell current spread
make new picture box at beginning
set name of picture box 1 to "NEW"
set bounds of picture box "NEW" to bounds of the_props
tell picture box "NEW"
set new_width to (width of bounds as real) - 3.7
set new_height to (height of bounds as real) - 3.7
set new_x to (left of bounds as real) + 3.7
set new_y to (top of bounds as real) + 3.7
set width of bounds to new_width
set height of bounds to new_height
set left of bounds to new_x
set top of bounds to new_y
set frame to {color:color spec "Magenta" of document 1 of application "QuarkXPress", gap color:null, gap shade:"100%", inside trap:default, outside trap:default, shade:"100%", style:solid line, width:".2 pt", gap opacity:"100%"}
end tell
end tell
repeat with i from 1 to count of layers
if name of layer i = "GUIDES" then set layer_exists to "YES"
end repeat
if layer_exists is not "YES" then
make new layer at front
set name of layer 1 to "GUIDES"
set suppress print of layer 1 to true
end if
set locked of layer "GUIDES" to false
--This is the line that moves the box to page 1, which is a prob if working on a multipage doc...
move picture box "NEW" to beginning of layer "GUIDES"
set content of picture box "NEW" to none content
set name of generic box "NEW" to null
set locked of layer "GUIDES" to true
set item spread coords to false
end tell
-------------------------
[This script was automatically tagged for color coded syntax by
Convert Script to Markup Code]