Define variable names via script from layer names?
Copy link to clipboard
Copied
It's possible to create script which go true whole PSD file and create variables using layer names? Now I must select each layer and type name manually. I want this option to automate, so layer name is always variable name? It's possible?
Explore related tutorials & articles
Copy link to clipboard
Copied
Yes with some caveats, such as layer groups, comps, hidden layers, etc.
Search on this forum, this topic has been covered a number of times.
Copy link to clipboard
Copied
Could you please explain what you mean exactly?
Maybe some screenshots could help illustrate.
Copy link to clipboard
Copied
my layer name is fx. dk-date and I want variable name make automated with same name as dk-date etc. so I dont must select each layer and type from finger
Copy link to clipboard
Copied
Could you please post meaningful screenshots with the pertinent Panels (Toolbar, Layers, Options Bar, …) visible?
Copy link to clipboard
Copied
Here is how looks my layers. Automation/script should select layer in variables dropdown, copy name and paste into field for "Text replacement". Im working on the system for "Multilingual designs translation". fx for marketing, when you have 1 banner design in 10 languages.
After all changes, I have script to export all layer names to csv, then people can translate layers and on the end I can import csv again to PS via Variables 🙂 I done 98%, I'm missing only this part. My idea works also without but if you have many layer, design must spend time only on "select from dropdow" and type the layer name again, and It takes time. 🙂 When everything is done, I will publish whole base to all users.
Copy link to clipboard
Copied
Do you mean variables as in the scripting term... Or do you mean Variables in the "data driven graphics" term:
https://helpx.adobe.com/au/photoshop/using/creating-data-driven-graphics.html
Copy link to clipboard
Copied
Right now I must go to Image > Variable > Define > and write manually Variable name in Variable type, but I want this make somehow automatically if possible, so I save time with typing when I have a lot of layers.
Copy link to clipboard
Copied
Exactly, there is is anoing one step >
Rename a variable
- Choose Image > Variables > Define.
- Choose the layer that contains the variable from the Layer pop‑up menu.
- To rename the variable, enter a name in the Name text box. Variable names must begin with a letter, underscore, or colon and cannot contain spaces or special characters (except for periods, hyphens, underscores, and colons).
- To remove the variable, deselect it.
And I want to some how make it easier and faster, select in dropdown, type with finger... it's ok when you have 5 layers, but I'm expecting more than 30... few times per week so it's generate waste of time
Copy link to clipboard
Copied
Here is a link to the only script code that I know of for variables:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/using-datasets/td-p/2665594

