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.
A questions and amendment:
Would anybody advice how to get points' coordinates (3+ distinctive points) from a pseudo circular selection
to fit/circumsize a new circle/ellipse selection upon them? I mean using Adobe Scripting...??
The idea is to make first an automatic, rough selection /eg using magic wand/ on a circular object/to extract it from the background/ - this part I have already.
Then-having above, I need to precise the selection choosing a few points from that selection, with their coordinates(min.3 of course), distant enough from each other and to circumsize circle or elliptical selection on them. All in scripting of course, for automation.
Most probably more than minimum-3 points- and a few iterations would be necessary to circumsize a circle or ellipse fitting 1st, rough selection.
cheers, thanks in advance for any hints,
the easiest way to convert a rough shape to an oval would be:
// Here I'm doing a duplicate to retain the rough shape: // ( rough shape selected. ) var dupShape = app.selection.duplicate(); dupShape.convertShape( ConvertShapeOptions.CONVERT_TO_OVAL );
Don't know if that will fit in your case.
Could you do some screenshots to illustrate your problem?
The idea has been well presented here: Action that remove background and image batch process
And I just would like to extend its functionality with sth like this: Circle Fit (Pratt method) - File Exchange - MATLAB Central
Be it a circle/as its a special case of an ellipse/ or ellipse, plus enabling additional functionality/settings with smoothing, extending, refining selection path.
Hope its possible with Adobe Java scripting, now Iam starting to learn the coding ))