Renaming photoshop layers

JD
Posted By
Jason_De_Donno
Aug 19, 2004
Views
401
Replies
9
Status
Closed
Is there a way of renaming all Photoshop layers at once?

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

Aug 19, 2004
No, there isn’t.

[EDIT: Unless it can be done via Scripting…never explored that possibility]
TM
Trevor_Morris
Aug 20, 2004
Yes, you can accomplish this via scripting. Try this:

main();

function main()
{
var layerName = prompt("Please enter a layer name.");

if (layerName)
{
var doc = app.activeDocument;

var layers = doc.layers;
for (var i = 0; i < layers.length; i++) { var layer = layers[i]; var layerVisible = layer.visible;

layer.name = layerName;
layer.visible = layerVisible;
}
}
}
DR
Danny_Raphael
Aug 21, 2004
Trevor:

Is this JavaScript code? If so, I’m getting an error ("Error 24: Prompt is not a function.") on this statement:

var layerName = prompt("Please enter a layer name.");

tia…
~Danny~
DM
dave_milbut
Aug 21, 2004
TM
Trevor_Morris
Aug 25, 2004
Danny,

What version of PS are you using? The script was written for PS CS.
JD
Jason_De_Donno
Aug 27, 2004
Thanks Trevor. Using CS. But that looks like a C++ snippet to me! What do I do with it? Compile it or what? I’ve no idea how I’d implement it.

By the looks of that script, it’s not quite what I meant. What I want to do is open a Photoshop Document with a set of arbritarily named layers, and then rename them all with generic layer1, layer2 etc
TM
Trevor_Morris
Aug 27, 2004
Jason,

The script is simple Javascript. Save the file as RenameLayers.js (or whatever), place it in your Presets/Scripts folder (located inside the Photoshop CS install folder) and then select it from File, Scripts, RenameLayers.js

As for modifying the script, have a read through the Documents in the Scripting Guides folder (located inside the Photoshop CS install folder) for instructions on how to write scripts. There are plenty of examples included and there is even a dedicated forum group for PS Scripting.

Hope that helps.
JD
Jason_De_Donno
Aug 30, 2004
Many thanks for the help. This is new and interesting stuff for me.

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

Related Discussion Topics

Nice and short text about related topics in discussion sections