Skip to main content
Inspiring
May 2, 2024
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
femkeblanco
femkeblancoCorrect answer
Legend
May 2, 2024

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.  

Translate