• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
3

how to get all joint point value in textframe area text using extendscript?

Explorer ,
Feb 12, 2024 Feb 12, 2024

Copy link to clipboard

Copied

Hi ,

 

I need to get all join point value in custom area text (textframe) using extendscript?. Capture.PNG

 

i try this,

app.activeDocument.selection[0].geometricBounds;

it returns

69.1558441558445,-109.363636363636,586.038961038961,-426.246753246753

 

Please help.

TOPICS
Draw and design , How-to , Scripting , Tools , Type

Views

252

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Feb 12, 2024 Feb 12, 2024

Area text frames have a textPath associated with them. this textpath is what holds the information for where the anchor points are. To get to it via extendscript you can do as follows

var thisFrame = app.activeDocument.textFrames[0]
alert(thisFrame.textPath.pathPoints.length)
/* just checking how many path points come up */
for(var p=0;p<thisFrame.textPath.pathPoints.length;p++){
    var thisPoint = thisFrame.textPath.pathPoints[p]
    /* here we get the reference to the pathpoint and can do what
...

Votes

Translate

Translate
Adobe
Participant ,
Feb 12, 2024 Feb 12, 2024

Copy link to clipboard

Copied

Area text frames have a textPath associated with them. this textpath is what holds the information for where the anchor points are. To get to it via extendscript you can do as follows

var thisFrame = app.activeDocument.textFrames[0]
alert(thisFrame.textPath.pathPoints.length)
/* just checking how many path points come up */
for(var p=0;p<thisFrame.textPath.pathPoints.length;p++){
    var thisPoint = thisFrame.textPath.pathPoints[p]
    /* here we get the reference to the pathpoint and can do what we want. simple alert for what the anchor value is */
    alert(thisPoint.anchor)
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 12, 2024 Feb 12, 2024

Copy link to clipboard

Copied

Hi RobOctopus,

 

Thanks for your reply, it returns only 4 points not for all.

 

529.357142848246,-561.500000000002
463.303571424123,-626.107142857143
397.25,-561.500000000002
463.303571424123,-496.892857142859

 

I attached my ai file here for your reference.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 12, 2024 Feb 12, 2024

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 12, 2024 Feb 12, 2024

Copy link to clipboard

Copied

Hi @Arunkumar25715058ufpl, I tried with your example file, with the large text frame selected and I get 12 path points, which is correct. And @RobOctopus's code is quite correct, but you did not adjust it to target the text frame you want. For example, here's a version directly operating on the selection:

alert(app.activeDocument.selection[0].textPath.pathPoints.length + ' points in selected text path');

Hope that helps.

- Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 12, 2024 Feb 12, 2024

Copy link to clipboard

Copied

looks like you are looking at the path points for the circle text frame. if you just copied the code i wrote it is referencing the 0 text frame, based on the file you need the last textframe in your stack. changing the code to use selection[0] instead of textFrames would allow you to just select one and examine it. This is what I got for your odd shape text frame

PathPoint: 0 x:407.370,y:-456.248
PathPoint: 1 x:58.020,y:-456.248
PathPoint: 2 x:50.227,y:-375.728
PathPoint: 3 x:50.227,y:-290.014
PathPoint: 4 x:60.617,y:-210.793
PathPoint: 5 x:76.201,y:-139.365
PathPoint: 6 x:156.721,y:-139.365
PathPoint: 7 x:526.851,y:-139.365
PathPoint: 8 x:548.929,y:-169.235
PathPoint: 9 x:567.110,y:-196.508
PathPoint: 10 x:404.773,y:-199.105
PathPoint: 11 x:406.071,y:-338.066

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 12, 2024 Feb 12, 2024

Copy link to clipboard

Copied

LATEST

Yes RobOctopus, i missed that selection[0]. Now it returns all points.

Thanks for your support.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines