What do you mean by path? Are you literally talking about text along a path? If so, you should be able to use:
to get a reference to the path or you could use:
which at least has you call the thing by a more appropriate name.
I'm assuming you don't have this threaded in a story.
Thank you for replying, though I am sorry for responding so late. What I want could be better explained by the screenshot below:
Here you can see that there is a text frame in this document. The text 'Hello' is selected in the text frame. I want to get the coordinates/bounds of the four corners that cover the word. In other words, the coordinates/bounds of the selection.
How can I get this?
What you suggested returned me the whole text frame. But I want the coordinates or bounds of the sub-text.
You can try as below:
mySelection = app.selection.createOutlines(false); myBounds = mySelection.geometricBounds; mySelection.remove(); alert("myBounds: "+myBounds);
Thanks a tonne for the help... It solved my problem..
A question related to the answer you posted.. The sample preview I loaded had some simple text in a simple text frame.
What if the text was written using the path tool? What will be the coordinates returned in that case? When I tried the above sample code with a transformed text frame or path text, I found that the coordinates returned were of an (invisible) rectangle enclosing the selected text.
Please see below image for more details,
As seen in the above example, a path text that is selected, the coordinates I get are of the yellow rectangle which encloses the text. Is this as far as I am going to get or is there another way?
No. You could get farther :-)
The moment the path of the selected text is created through the createOutlines(false) method, you'll have an object that itself is constructed out of paths. And these paths have pathPoints. You could travel through all the pathPoints of all paths created to find out some useful coordinates by looking at the property anchor of a individual pathPoint. That will give you the position as array like that: [x,y].
Now you can calculate something like the top most pathPoint etc.pp.