I am trying to determine if an object in InDesign CS4 is at the bottom of the stacking order on its layer. I haven’t seen any reference to an object’s stacking order in the Dictionary. The one thing that may help me is the fact that “Send to Back” is grayed out when the object is bottommost. I have yet to try System Events to “try” this, and then undo if it succeeds. Likewise if it errors I would have my answer. However, I don’t think system events “error” if the menu item isn’t accessible, not to mention there is probably a better way”I don’t trust an undo?
Anybody want to take a stab at this one? I don’t blame you if you don’t.
Jerome,
You don’t know how glad I am that you replied to my post.
This is what I needed. However I needed to test for this on a layer, but that part was simple.
Thank you very much.
Not that I need this functionality below.
But maybe you can point me in the right direction for future reference. What if I was trying to determine if a selected object was the bottommost object. My script is not working, and I tried other things to no avail.
tell application "Adobe InDesign CS4"
tell application "Adobe InDesign CS4"
activate
tell document 1
set sel to selection
set x to page item of sel
set theLayer to layer 1
set x to count of page items of theLayer
if x is last page item of theLayer then
--do something here
display dialog "wow, this is the bottom object of the stacking order of layer 1"
end if
end tell
end tell
end tell
First ID returns a list of items for the selection even if there is only one item so that needs to be converted to a single item for testing.
then you are converting x to the count of the page items, but in your if statement you are trying to compare the objects.
The below code should work.
tell application "Adobe InDesign CS4"
--activate
tell document 1
set sel to selection
set sel to item 1 of sel
set theLayer to layer 1
if sel is last page item of theLayer then
--do something here
display dialog "wow, this is the bottom object of the stacking order of layer 1"
end if
end tell
end tell
Blue, I have been doing it for over 13 years as well. I wouldn’t know where to start actually finding paying work. I have had one company in Australia contact me for a job, but other than passing interest no one I have talked to is interested or seems to see the value in actually paying for it.