Is there a simple way to find the page of a given object?

Previous topic - Next topic

TemperateBroadleaf

I can't seem to find any current documentation on how to programmatically get the page of a given selected object. There is an example given on the wiki page for scripting, but it doesn't seem to work as PAGEOBJECT doesn't have an ANNAME attribute. (I assume this is due to some change in the spec since the guide was originally written.)

Is there any way of doing this? (Note that I'm aware of workarounds for achieving the end result I'm looking for; I'm asking this specific question because it seems like it should be possible, but I can't find any way of doing so.)

EDIT: Additional note, in case anyone asks: selectObject("name") does not appear to update the current working page to match the selected object. If I iterate over a list of objects using deselectAll() followed by selectObject("name") and check the current working page with currentPage() each time, it will give the same result regardless of which object is currently selected.

MrB


TemperateBroadleaf

Quote from: MrB on May 29, 2024, 10:22:16 PMHow about getItemPageNumber() ?
Wow, I have no idea how that slipped by me in the docs. I think I spent all my time looking at "Frame Properties" and "Pages" rather than the more general "Items". Solved. Thank you!

One follow-up, though: that linked example from the wiki is truly out of date, right? Meaning, there's no longer an attribute called "ANNAME" attached to PAGEOBJECT in the XML? Assuming that's true, I'll update it with a working alternative when I get a chance.

MrB

ANNAME="Blah" is correct where that is the name given to the object.
OwnPage stores the page number of the object.
I wouldn't be surprised if that code needs updating but I'm not sure myself if it needs changing or exactly how.