Hi
I’m trying to modify the content of the master page for a Quark document.
The part of the script which refers to the current box (tell current box) selected on the master page works fine, but when I then try and modify the master page as a whole (by adding in lines based on the leading information gleaned from the initial box) I get ‘QuarkXpress got an error: Can’t get line box.’ If I modify the script to run on, for example, page 1 it works fine.
I have read that scripting Quark master pages is tricky / no possible. Does anyone have any experience?
tell application "QuarkXPress"
tell front document
if not (exists current box) then error "A single text box must be selected."
--- strip out returns at end of text
tell current box
tell story 1
repeat until the last paragraph is not ""
if it is not "" then
delete last character
else
exit repeat
end if
end repeat
--- count categories
count (every text whose contents = (ASCII character 13))
set numberofcats to result
set numberofcats to (numberofcats + 1)
--- calculate leading
set categoryleading to (((212 - 52) / numberofcats) * 2.83475)
set leading to categoryleading
end tell
end tell
end tell
tell front document
--- put in dividing lines
tell master document 1
set startBounds to {59, 52 + (categoryleading / 2.83475), 247, 52 + (categoryleading / 2.83475)}
repeat with i from 0 to (numberofcats - 2)
make line box at beginning with properties {bounds:{(item 1 of startBounds), (item 2 of startBounds) + ((categoryleading / 2.83475) * i), (item 3 of startBounds), (item 4 of startBounds) + ((categoryleading / 2.83475) * i)}, width:0}
end repeat
end tell
end tell
end tell
Thanks in advance
Mark
[Quark 6.5
OS X 10.4.8]