Copy link to clipboard
Copied
Hello, I'm Rahadyan,
I'm making a script to find out if one of the vertex path points is selected or not.
The code is like this:
var shapeLayer = app. project. activeItem. layer("Shape Layer 1");
var pathProperty = shapeLayer.property("Contents").property("Rectangle 1").property("Contents").property("Path 1").property("Path");
var pathData = pathProperty.value;
var points = pathData. vertices;
var vertex = points[1];
if (vertex. selected) {
alert("Vertex is currently selected!");
} else {
alert("Vertex is not selected.");
}
After I tried running it, even though I had selected the intended vertex it was still "Vertex is not selected.".
Is there something wrong with my code? Please help.
Copy link to clipboard
Copied
The vertices of a shape are an array and each of the entries is just an array of length 2 (containing x and y value), see
https://ae-scripting.docsforadobe.dev/other/shape.html#shape-vertices
So the vertices don't contain additional attributes like "selected" and hence your if condition always evaluates to false.
As far as I know there is no way to retrieve the information which vertices are selected with a script, unfortunately.