Jsx code to find a specific Folder and Rename it
Hi everybody, this is my first message in this community which I follow for quite sometime! As many I've started working with Js for Photoshop and I am stuck, so I would love to see your help!
I have created a set of Layers in a Ps document. A Layer called Photo #1 and a Folder called Photos.
I need a piece of code, that tries and search the folders (LayerSets) of my document, try to find if a specific folder name is met and then change it's name to a new.
So far I have found the way to change the name of my Photos Folders, with the following code
var doc = app.activeDocument;
if (doc.layerSets.getByName("Photos") ) {
alert ("GOALL!!! I see the Photos Folder")
doc.activeLayer.name = "New Folder Name";
}
This is ok for one folder, if this folder exists and it's named Photos, but sometimes I need the system to search for 3 folder names (Photos, Left Page, Right Page).
If I use the getByName("a folder") and the specific "a folder" doesn't exist, it creates an error.
So I need the system to try to find if one of those 3 Folder names exists, and it one at least exists to continue without errors.
Please help!
