Skip to main content
Known Participant
January 8, 2024
Answered

Batch rename top layer in many PSD files

  • January 8, 2024
  • 1 reply
  • 418 views

Hi,

 

I am looking for a way to batch rename the top layer in many PSD files to say "First"

I have 100s of PSD files and I have to rename top layer on all those files to "First", how can I achieve it?

This topic has been closed for replies.
Correct answer Stephen Marsh

The simplest way is generic:

 

activeDocument.layers[0].name = "First";

 

However, if you don't wish to affect existing layer visibility, then another generic approach is:

 

if (activeDocument.layers[0].visible === false) {
    activeDocument.layers[0].name = "First";
    activeDocument.layers[0].visible = false;
} else {
    activeDocument.layers[0].name = "First";
}

 

Further checks could be implemented to only affect certain specific layer kinds.

 

You can then record the script into an action, then use Automate > Batch to apply the action to multiple files.

 

Of course, a batch script could also be created.

1 reply

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
January 8, 2024

The simplest way is generic:

 

activeDocument.layers[0].name = "First";

 

However, if you don't wish to affect existing layer visibility, then another generic approach is:

 

if (activeDocument.layers[0].visible === false) {
    activeDocument.layers[0].name = "First";
    activeDocument.layers[0].visible = false;
} else {
    activeDocument.layers[0].name = "First";
}

 

Further checks could be implemented to only affect certain specific layer kinds.

 

You can then record the script into an action, then use Automate > Batch to apply the action to multiple files.

 

Of course, a batch script could also be created.

StarAG​Author
Known Participant
January 8, 2024

Thanks, worked accurately

Stephen Marsh
Community Expert
Community Expert
January 8, 2024
quote

Thanks, worked accurately


By @StarAG​

 

You're welcome!