get page number of selected text box

Hi,

Could any one help me to get the page number of a selected text box in quarkxpress v6.

For example, if I select a text box in page 5 (page number not known at the time of select), then the script should return page number “5”.

Thanks,
Gopal

This is my idea for your problem:


tell application "QuarkXPress Passport"
	if (current box exists) then
		tell document 1
			set boxid to uniqueID of current box
			set pagenos to count of pages
			repeat with i from 1 to pagenos
				tell page i
					try
						set boxids to uniqueID of every generic box
						if boxid is in boxids then
							tell me
								activate
								display dialog ("The selected box is on page no. " & i) buttons {"OK"} default button 1 with icon note
							end tell
						end if
					end try
				end tell
			end repeat
		end tell
	end if
end tell

Depending on how your doc is set up you may want to go about this one of two ways. If you have used sections you may want to use name instead of number.


tell application "QuarkXPress"
	set CurBox to object reference of current box
	set Page_Name to name of page 1 of CurBox
	set Page_Number to page number of page 1 of CurBox
end tell

BWT I think if the box is on the pasteboard not a page then it will return “2001” I don’t know why but it does. This applies for top, left & bottom of spread “2002” is returned if right of spread.