Index of pathPoints from pathItems Selection
Using the Direct Selection Tool I would like to target a single anchor point on multiple pathItems and return their index so I can push their respective X and Y coordinates to an array. I am enclosing a code snippet where the index is static and not stemming from the selection.
var idoc = app.activeDocument;
var pathSelection = idoc.selection;
var pathAnchors = [];
for (var i = 0; i < pathSelection.length; i++) {
var selectedPath = pathSelection[i];
// anchor point of the selected path
var selectedAnchorPoint = selectedPath.pathPoints[0]; // help acquiring pathPoints index from selection
// x and y coordinates
var anchorX = selectedAnchorPoint.anchor[0];
var anchorY = selectedAnchorPoint.anchor[1];
pathAnchors.push({x: anchorX, y: anchorY});
alert("<<< Array Contents >>>\n\nX: " + pathAnchors[i].x + "\n\nY: " + pathAnchors[i].y);
}