The title of your query suggests you want to create a list of objects per page, but then
> line is in front of circle in list I'll got "line, circle", when I change order and
> circle is in front of line the list of objects is the same ("line, circle")
seems to suggest you also want to change the order of the objects on the page. And by 'order' you presumably mean stacking order, correct?
The order - you are talking about - is the one shown in LayerPanel. So, basically, myDoc.layers.everyItem().allPageItems should show a proper list... but
...you may need to filter it by "parentPage" property cause Page object has not "layer" property to call it directly
thank you for your time.
Yes you are right, I meant stacking order, but I do not need to change stacking order by script, I need to check and compare stacking order with another documents (same objects, but it could happen that operator acidently change order and it is hard to find this in PDF)
Thank you Jarek for the tip, will try this and let you know.
maybe it's better to work with document.spreads :
and check itemLayer and parentPage properties of every individual page item in that array.
( InDesign CS5 and above)
That would reflect the order of items as seen from the Layers Panel in the UI.
document.spreads is working solution.
Thank you to all for help.
glad that it's working.
Be aware, that allPageItems will also store nested page items ( anchored objects, grouped page items etc.pp.). If I understand your task correctly, you have to work with the "first level" ones only. The parent property of such objects will always return "Spread" objects (InDesign CS5 and above).