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

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

New Here ,
Aug 23, 2023 Aug 23, 2023

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.

TOPICS
Scripting

Views

98

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
Community Expert ,
Aug 24, 2023 Aug 24, 2023

Copy link to clipboard

Copied

LATEST

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

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