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;
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#GraphicLine.html#d1e223036
There is left and right - not start / end.
Copy link to clipboard
Copied
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#GraphicLine.html#d1e223036
There is left and right - not start / end.
Copy link to clipboard
Copied
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;
}