Photoshop, script to find a layer that contains a word in its layer's name Photoshop, script to find a layer that contains a word in its layer's name

hope you guys can help me. I need a script that can find a layers name, for example if i have this layers:

  • Wood 123 Canvas
  • Wood 456 Specular
  • Wood 789 Lights

And i would like to find the layer that contains Canvas. And maybe, if its possible, change the layer's name color to green.

I found also this code i tried:

try {
(ref1 = new ActionReference()).putName(stringIDToTypeID('layer'),"Canvas"); // replace Canvas with your layer name
(desc1 = new ActionDescriptor()).putReference(stringIDToTypeID('null'), ref1)
executeAction(stringIDToTypeID('select'), desc1, DialogModes.NO);
} catch (e) {
    alert("Sorry, this layername does not exists");
}

This works great but only if the layer's name is exactly "Canvas".. and that's the problem



from Stackoverflow

Comments

Popular posts from this blog

I am having trouble with this ajax timer it is not doing what I expect and does not execute I am having trouble with this ajax timer it is not doing what I expect and does not execute

Refresh page after clicking button (ok / cancel) Refresh page after clicking button (ok / cancel)

JS Upload file to HTML File Element preserving the effects of a regular click JS Upload file to HTML File Element preserving the effects of a regular click