I am working on a script in which I want to move out from the insertion point or a cluster of selected characters to select the word where the selection occurs. The parent object in this instance is Story or Cell, not Word. How do I figure out what word the selection is in?
This made me realize I have no idea how InsertionPoint, Character, Word, Text, Line, Paragraph are related to one another or how to move outwards (or inwards) when trying to expand or contract from a selection to a particular object in the document.
Any pointers to schemas or diagrams or even explanations as to how these InDesign objects fit together and how to navigate them when the selection is either contained by or contains the object you want to act on?
Indesign's DOM model is not quite as treelike as it seems at first. The "parent" property can point to many different objects depending on the context. It seems strange at first, but keep at it and after a while experience kicks in and (wel.. it will still seem kind of strange when you stop to think about it, but you will usualy not stop )
To answer your initial question:
myInsertionPoint.words should get you what you need.
myInsertionPoint.paragraphs will give you the parent paragraph, that is unless the insertionPoint is the last one in the paragraph. If it is, that call will return the next paragraph.
@Vamitul Thanks, you have pointed in me in the direction I need to go.