Hello,
I just thought I’d ask this question on the off-chance that someone might know. Is it possible to identify what page a selected textbox is on? I’ve searched all the way through a text box’s properties and found nothing obvious.
I’ve done it via looping through a page, and checking the text boxes, but when you get the reference of a ‘current box’ it doesn’t mention the page.
Don’t have time to write the whole thing out at the moment, but I would approach it by first getting the unique ID of the current text box, and then set up a repeat loop in another repeat loop to basically go through each text box on each page and compare the unique ID. When they match set a variable to the value of the page number variable of your loop. When it finishes you will have the page number.
There may be an easier solution but that’s all I can think of quickly.
Model: G5 Tower (not Intel) - Script Editor ver 2.1.1
Operating System: Mac OS X (10.4)
I’m trying to remember how to get the page from an item…and it’s not coming to me. You could always tell the document to show the item then get the current page. It’s not the most elegant way but it should work.
I think this is about the easiest way!! not sure but has worked for me.
tell application "QuarkXPress"
activate
tell document 1
set CurBox to object reference of current box
set MyPage to name of page 1 of CurBox
end tell
end tell
Hello,
Thanks for your replies.
Matt - this is what I’m doing at the moment. It works but I figured that one less repeat loop in a script could make it run quicker.
Jerome - I’m guessing you were thinking along the same lines as Mark.
Mark - I’ll give your script a try and let you know what i find.
I try to keep away from the current page thing as i caused me too many problems as its based on the view in the doc window an edge creaping over gives the wrong results.
Yea, Mark’s solution sounds familiar and it probably the best solution. It has been over 18 months since I needed to do that. Mark, I agree with your concerns. From what I have seen the show command puts the referenced item at the top left of the window so that shouldn’t, but could be a problem.
Hi
I’m doing some work with the selection and found that Mark’s script worked fine.
tell application "QuarkXPress"
set objSel to selection
if objSel is not null then
try
if class of objSel = text then
set intID to uniqueID of text box 1 of objSel
set intOffset to (offset of objSel)
set intCount to count of characters of objSel
tell document 1
set CurBox to object reference of text box id intID
set MyPage to name of page 1 of CurBox as number
end tell
{objSel, intID, intOffset, intCount, MyPage}
end if -- end of text on selection's class
end try
end if
end tell