Skip to main content
Inspiring
May 2, 2024
Answered

How can I check the name of a figure in a script?

  • May 2, 2024
  • 1 reply
  • 245 views

The scene contains two shapes: a rectangle and an ellipse.
The rectangle shape has been renamed to "Rectangle".
The ellipse shape has not been renamed and is named "<Ellipse>".
Using a script I want to rename the ellipse to "Circle"
for this in the script

 

var aiDocument = app.documents[0];
var carentLayer = aiDocument.layers[0];

I'm using...

 

if (carentLayer.pathItems[k].name == undefined){
   carentLayer.pathItems[k].name =  "Circle";
}


but such a check does not lead to success.

 

How can I check the name of a figure in a script?

This topic has been closed for replies.
Correct answer femkeblanco

Unnamed items are an empty string (""), not undefined.  

1 reply

femkeblanco
femkeblancoCorrect answer
Legend
May 2, 2024

Unnamed items are an empty string (""), not undefined.