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

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

Explorer ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

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.JPG

 

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.JPG

TOPICS
Scripting

Views

223

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

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;
}

Votes

Translate

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.

 

Votes

Translate

Translate
Adobe
Guide ,
Apr 15, 2022 Apr 15, 2022

Copy link to clipboard

Copied

// select items
var input = prompt("");
for (var i = 0; i < app.selection.length; i++) {
    app.selection[i].name = input + app.selection[i].name;
}

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

Copy link to clipboard

Copied

Perfect! That's what i needed.

 

Thank you so much for your time! 🙂

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

Copy link to clipboard

Copied

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.

 

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

Copy link to clipboard

Copied

LATEST

Deffinetly helpfull!

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