Copy link to clipboard
Copied
I have seen a lot of scripts that export the layer names to text file, but does anyone know of a script that does the opposite?
I would like to rename my layers by importing names from a text file.
For example:
Does anyone know of a script that can import those words from a text, and rename the layers?
Thanks!
Copy link to clipboard
Copied
How (according to which rule) should the script know which layer should receive which new name?
For the beginning (rename the active layer):
var newName = "Bob";
activeDocument.activeLayer.name = newName;
Copy link to clipboard
Copied
Hi, Thanks.
In my particular case, it does matter which layers get which name. I was just looking for an easy way to assign these names to the 90+ identical layers.
Thanks for the start.
Copy link to clipboard
Copied
* Sorry: Meant to say "it doesn't matter which layers get which names"
Copy link to clipboard
Copied
Using what @pixxxelschubser posted, there are many scripts posted that show how to read info from a text file. Using a spreadsheet program, you can convert that to a CSV file, import it into a variable, then use the split command to separate the variable into an array with all the names. Then loop through the array to assign them to the layers.
Copy link to clipboard
Copied
Are your layers pixel layers (art layers)?
Are your layers arranged in a hierarchy (or perhaps deeply nested in different layer sets)?
Can you perhaps upload a simplified PSD example (without confidential data) and link it here?
Copy link to clipboard
Copied
Hi,
Thanks for your reply.
Yes they are just pixel layers. They are all in one folder, not sorted in any way. And I have a list of names I would like to assign to each layer in no particular order.
This is a link to the PSD file and name list - https://1drv.ms/u/s!At5a8ggd7x62hId6-FWXuq2Ni8PBGw?e=gB9KbO
The PSD file only has the layers in a folder, and there is an example list of names which I was hoping to apply.
Thanks for your help!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
There are 95 layers in the group... While the text file has 54 names.
How should this mismatch be solved?
Copy link to clipboard
Copied
No, I would expand the list of name to match the number of layer at a later point. For now, it's just a test to see how it works.
Side question: Is it possible to import the xy values (coordinates) too? So the text has:
layer_name_1, x, y
layer_name_2, x, y
layer_name_3, x, y
....etc