Thread View: adobe.scripting.indesign
7 messages
7 total messages
Started by Dave_Saunders
Sat, 14 Feb 2009 20:26
Own parent
Author: Dave_Saunders
Date: Sat, 14 Feb 2009 20:26
Date: Sat, 14 Feb 2009 20:26
9 lines
1135 bytes
1135 bytes
We all know that the InDesign application object is its own parent, but can anyone identify another object that can be its own parent? I stumbled on this by accident the other day. Just to be clear, I'm not talking about an object of a similar kind being the parent, for example, a rectangle can contain some other rectangle, I'm talking about an object which is its own parent. Hint: even though what I've said is true, if you happen to pass one of these objects to the findPage/findWhere functions we've been playing with lately, you'll not be dumped into an endless loop. [Huh! How is that possible?] Dave
Re: Own parent
Author: Harbs
Date: Sat, 14 Feb 2009 21:22
Date: Sat, 14 Feb 2009 21:22
11 lines
942 bytes
942 bytes
Hmm. That's a really good riddle! The only object I could think of that fits the clue is Character. Sure enough Character is listed in the OMV under the possible parents of a Character. Under what situation that can happen? I've no idea... =-O -- Harbs http://www.in-tools.com
Re: Own parent
Author: Dave_Saunders
Date: Sat, 14 Feb 2009 21:47
Date: Sat, 14 Feb 2009 21:47
3 lines
703 bytes
703 bytes
You're on the right track, but it's not character (nor any text object). The parent of a character is always the story (or XMLStory). Dave
Re: Own parent
Author: Dave_Saunders
Date: Sat, 14 Feb 2009 22:00
Date: Sat, 14 Feb 2009 22:00
11 lines
845 bytes
845 bytes
What do you know, I've just found two other related objects that have the same characteristic. They can be their own parent -- by which I mean, if you ask for: myObj.parent the object you get is myObj. Even to the extent that: myObj.parent == myObj returns true. Dave
Re: Own parent
Author: Harbs
Date: Sat, 14 Feb 2009 22:45
Date: Sat, 14 Feb 2009 22:45
5 lines
708 bytes
708 bytes
Okay. So when is a Cell its own parent? -- Harbs http://www.in-tools.com
Re: Own parent
Author: Dave_Saunders
Date: Sun, 15 Feb 2009 00:34
Date: Sun, 15 Feb 2009 00:34
19 lines
1127 bytes
1127 bytes
That's it. myCell = myTable.cells[0]; myOtherCellRef = myCell.cells[0]; myOtherCellRef == myCell; returns true but myOtherCellRef.parent == myCell; also returns true same thing happens with rows (and I assume columns). I suspect that it has something to do with the fact that you can reference sets of cells or it could just be an accidental thing. myCell = myTable.cells[0].cells[0].cells[0].cells[0]; also works and gives you the same cell and if you work your way up the parental chain it takes you four steps to get to the table. Dave
Re: Own parent
Author: Harbs
Date: Sun, 15 Feb 2009 17:03
Date: Sun, 15 Feb 2009 17:03
15 lines
1261 bytes
1261 bytes
Very interesting! The same basic concept applies to text objects. A Character.characters[0].characters[0], etc. will always be the same object. It only works down the parent chain. If you work up the chain, the immediate parent will be the story. I think the fact that it works down the chain is probably a feature (i.e. if you do a search you can refer to characters[0] no matter what the search returns -- even a Character). The fact that cells work up the chain is probably a bug... -- Harbs http://www.in-tools.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads