Skip to main content
rahadyan hendrasta
Participant
August 24, 2023
Question

How to select one of the vertex path points with a script?

  • August 24, 2023
  • 1 reply
  • 202 views

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.

This topic has been closed for replies.

1 reply

Mathias Moehl
Community Expert
Community Expert
August 24, 2023

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.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects