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

Script to apply arrowhead in Stroke (Indesign). Help?

Explorer ,
Dec 05, 2024 Dec 05, 2024

Copy link to clipboard

Copied

Can someone help me create a script? I'm trying to create a script to create a path and then apply "arrowheads" to it. I can't apply "arrowheads" to a created path, only create the path. I've tried other possibilities, but I can't. Can anyone solve this?

 

var doc = app.activeDocument;
var page = doc.pages[0];

// Create a line with a stroke
var line = page.graphicLines.add();
line.strokeWeight = 2;
line.strokeColor = doc.swatches.itemByName("Black");

// Set the start and end points of the line (example coordinates)
line.paths[0].entirePath = [[10, 10], [40, 10]];

// Apply a start arrowhead to the line
line.paths[0].startArrowhead = ArrowHead.TRIANGLE_ARROW_HEAD;

// Apply an end arrowhead to the line
line.paths[0].endArrowhead = ArrowHead.TRIANGLE_ARROW_HEAD;

 

 

TOPICS
Experiment , Feature request , How to , Scripting

Views

93

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

Community Expert , Dec 05, 2024 Dec 05, 2024

Votes

Translate

Translate
Community Expert ,
Dec 05, 2024 Dec 05, 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
Explorer ,
Dec 06, 2024 Dec 06, 2024

Copy link to clipboard

Copied

LATEST

That's right, it makes perfect sense. I couldn't make the connection between the code and the sides either. Thanks!

if (myGraphicLine instanceof GraphicLine) {
myGraphicLine.leftLineEnd = ArrowHead.SIMPLE_ARROW_HEAD;

myGraphicLine.rightLineEnd = ArrowHead.TRIANGLE_ARROW_HEAD;
}

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