Skip to main content
Known Participant
January 26, 2024
Answered

Mass renaming identically-styled objects

  • January 26, 2024
  • 2 replies
  • 502 views

I need to rename every yellow rectangle in my project to have the same name.

 

Selecting them is easy, however I cannot find a way to rename them all to be the same thing, and the scripts online simply run without apparently doing anything (has the script API changed or something??)

 

Thanks in advance to those sparing their time to suggest approaches.
(there are a lot of yellow rectangles!)

 

This topic has been closed for replies.
Correct answer Kurt Gold

Sergey Osokin has a nice script to rename selected objects (Rename Items).

 

It comes with a modal dialog which is pretty useful if you want to rename items often.

 

Rename Items by Sergey Osokin

2 replies

Kurt Gold
Community Expert
Kurt GoldCommunity ExpertCorrect answer
Community Expert
January 26, 2024

Sergey Osokin has a nice script to rename selected objects (Rename Items).

 

It comes with a modal dialog which is pretty useful if you want to rename items often.

 

Rename Items by Sergey Osokin

__JMW__Author
Known Participant
January 29, 2024

Yes, that worked well, thank-you.

Doug A Roberts
Community Expert
Community Expert
January 26, 2024

Can you share a script that doesn't work as you expect?

__JMW__Author
Known Participant
January 26, 2024
Most are variants on this:
 
var docRef = app.activeDocument;  

var sel = docRef.selection;  

for (var i=0; i < sel.length; i++)  
     sel.name = "NewName";
CarlosCanto
Community Expert
Community Expert
January 26, 2024

this works

var docRef = app.activeDocument;  

var sel = docRef.selection;  

for (var i=0; i < sel.length; i++)  
     sel[i].name = "NewName";