I'm writing a script that looks for layers with a certain name in a document, and I need it to then check if it has any clipping masks applied to it, and select them all, so that I can merge and export them. I have lots of these layers littered through a PSD, with multiple PSDs. So doing this will hopefully save a tonne of time.
The issue I'm having is with the identifying clipping masks. I've looked through the reference files and I can't find anything relevant to them. Is there any way of doing this? Am I missing something here?
Here is the beginning of my code:
var doc = app.activeDocument
var ratios = ["1/1", "4/3", "3/4", "3/2", "2/3", "16/9", "9/3", "7/2", "11/5"];
for (var i = 0, il = doc.layers.length; i < il; i++) {
var curLayer = doc.layers[i];
for (var j = 0, jl = ratios.length; j < jl; j++) {
if (curLayer.name == ratios[j]) {
alert(curLayer.name);
// Check for clipping masks attached to this layer
}
}
}
Thanks for all your help!