Skip to main content
Inspiring
August 1, 2013
Question

Get coordinates of path of a text selection

  • August 1, 2013
  • 2 replies
  • 3790 views

Hi,

I want to get the coordinates of the path of the selection made on some text content. Is that possible?

Thanks!

This topic has been closed for replies.

2 replies

bluecd
Inspiring
March 19, 2018

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,

bbcd

Community Expert
March 19, 2018

Hi bbcd,

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[0].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?

Regards,
Uwe

bluecd
Inspiring
March 19, 2018

Hello,

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 ))

Kind regards,

bbcd

Inspiring
August 1, 2013

What do you mean by path? Are you literally talking about text along a path? If so, you should be able to use:

app.selection[0].parentTextFrames[0]

to get a reference to the path or you could use:

app.selection[0].parentStory.textContainers[0]

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.

Dave

poortip87Author
Inspiring
October 21, 2013

Hi Dave,

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.

Participant
October 21, 2013

Hi,

You can try as below:

mySelection = app.selection[0].createOutlines(false);

myBounds = mySelection[0].geometricBounds;

mySelection[0].remove();

alert("myBounds: "+myBounds);

Thanks,

ping rajesh