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

Can someone share script that adds text in front of object names in layers.

Explorer ,
Apr 14, 2022 Apr 14, 2022

I do have random named layers with objects inside (circles, random edged figurs etc.). Object names most of the times do not have anything in common. They can be different shapes and colours.

Adding text infront of objects - Starting point.JPGexpand image

 

Endgoal Example:

I select all objects in a layer or the layer (depends what is possible), run the script and some sort of popup comes up where I can place a text and it ads this text in front of every selected object in this layer only.

Adding text infront of objects - End Goal.JPGexpand image

TOPICS
Scripting
334
Translate
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

correct answers 2 Correct answers

Guide , Apr 15, 2022 Apr 15, 2022
// select items
var input = prompt("");
for (var i = 0; i < app.selection.length; i++) {
    app.selection[i].name = input + app.selection[i].name;
}
Translate
Community Expert , Apr 15, 2022 Apr 15, 2022

You may also take a look at this nice approach, provided by Sergey Osokin.

 

Rename Items

 

It has some additional options to use placeholders and consecutive numbering.

 

Translate
Adobe
Guide ,
Apr 15, 2022 Apr 15, 2022
// select items
var input = prompt("");
for (var i = 0; i < app.selection.length; i++) {
    app.selection[i].name = input + app.selection[i].name;
}
Translate
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
Explorer ,
Apr 15, 2022 Apr 15, 2022

Perfect! That's what i needed.

 

Thank you so much for your time! 🙂

Translate
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 ,
Apr 15, 2022 Apr 15, 2022

You may also take a look at this nice approach, provided by Sergey Osokin.

 

Rename Items

 

It has some additional options to use placeholders and consecutive numbering.

 

Translate
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
Explorer ,
Apr 18, 2022 Apr 18, 2022
LATEST

Deffinetly helpfull!

Translate
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