Action or script to prompt to add to layer name

Community Beginner ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Hi all,

Can anyone let me know if it's possible to create a script or action to prompt for a word to be entered, then add that name to all layers, or specific layers, or replace a specific word if it exists in layers.

 

e.g. I'm creating a template with generate image assets enabled so I can quickly and easily generate a predefined set of image sizes / formats etc. just from dropping the image into a smart layer.

That's all sorted and working - but I'd like to be able to specify the filenames based on the main image rather than having to rename layers individually and manually.

So I'd have 

Template Names                  Saved layer names

50x50.jpg                              New Logo 50x50.jpg

50x50.png                             New Logo 50x50.png

1000x1000.png                     New Logo 1000x1000.png

 

So rather than having to add "New Logo" or whatever the filename needs to be based on the project, I could just enter it once and then they get updated?

 

I hope that makes sense!

Fingers crossed

TOPICS
Actions and scripting

Views

86

Likes

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 1 Correct answer

Adobe Community Professional , Aug 06, 2022 Aug 06, 2022
@Big Rick Cowell – Try this script, it works on both layers and layer groups: https://github.com/Paul-Riggott/PS-Scripts/blob/master/Layer%20Name%20Edit.jsx A couple of examples, either adding a new name as a prefix, or using a regular expression find/replace to to the same:

Likes

Translate

Translate
Adobe Community Professional ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Likes

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 Beginner ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Yes - but must not have searched well, I was getting all sorts of unrelated results.

Thanks - checking it out now... 

Likes

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 Beginner ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

This looks almost exactly what I'm looking for - though I don't want it numbering the layers - I'll see if I can edit the script to stop that happening - though scripts aren't my forte!

Thanks again

Likes

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 Beginner ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

In fact - it's not quite enough for what I needed, just realised I should have specified I also need it to do groups as well as layers... I knew I'd miss something!

Likes

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
Adobe Community Professional ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

The script looks pretty simple, can you post screenshots of a beginning document, and finished, and point out what was missed or needs to be changed? We would need to see the expanded layers panel.

Likes

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
Adobe Community Professional ,
Aug 06, 2022 Aug 06, 2022

Copy link to clipboard

Copied

@Big Rick Cowell – Try this script, it works on both layers and layer groups:

 

https://github.com/Paul-Riggott/PS-Scripts/blob/master/Layer%20Name%20Edit.jsx

 

A couple of examples, either adding a new name as a prefix, or using a regular expression find/replace to to the same:

 

LNE.png

 

Likes

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 Beginner ,
2 hours ago 2 hours ago

Copy link to clipboard

Copied

Thanks @Stephen_A_Marsh - I'll give that a try asap!

Likes

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 Beginner ,
21m ago 21m ago

Copy link to clipboard

Copied

@Stephen_A_Marsh - perfect, thanks!

 

Likes

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 Beginner ,
13m ago 13m ago

Copy link to clipboard

Copied

LATEST

PS - just in case anyone else is using this and finds the same - the script window was pale grey on mine, so I've edited the background in the script - changing line 20 to:

var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0, 0, 0, 0]);

Likes

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