Locating page of selected text in Quark XPress

I hope one of you can help me out. My newest project involves taking a chunk of selected text on a page and turning it into a running head on that page. I have no trouble finding the properties of selected text. The problem is that said properties only return text range information without any reference to the current page on which it resides.

So, my next idea is that, since I’ve already checked to make sure some text is selected, I can assume that a box is selected. I can’t for the life of me figure out where to find the properties of the current box (since Quark wants a definite box reference before it gives up any information about a box).

Any suggestions on directions I should try would be heartily appreciated!

Best,

Andy

try this:

tell app “QuarkXPress”
set boxRef to object reference of text box 1 of selection
set selection to boxRef
set refPage to (page number of page 1 of text box 1 of selection)
end tell

you have to make sure the container box for the text is selected otherwise the page number responds with the spread page number. or so i have found.

(this works in XPress 5 some tweaking may be necessary for XPress 4 if i recall correctly)

-john

Why I couldn’t get this to work before is beyond me. Yesterday afternoon after my previous post, I managed to get it to work with this:

set thisBox to index of current box

and

set thisPage to page number of current page

I needed the page number to see if I was on a recto or verso. Here’s how I did that:

set pageDivided to thisPage / 2
set pageText to PageDivided as string
if pageText contains “.5” then
set VorR to “Recto”
else
set VorR to “Verso”
end if

Thanks for your help, though. :smiley: I’m …this… close to being able to save myself hours of typing!

Andy

By the way, I did manage to get the running head generator working. If anyone’s interested, I would be happy to discuss the method with them.

Andy