var color = new RGBColor()
color.red = 255;
color.blue = 255;
color.green = 255;
app.foregroundColor.rgb = color;
function loadTransparency(){
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
var ref1 = new ActionReference();
ref1.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Trsp" ) );
desc.putReference( charIDToTypeID( "T " ), ref1 );
executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
}
documents.add(app.activeDocument.width, app.activeDocument.height, app.activeDocument.resolution, "testDoc", NewDocumentMode.RGB)
app.activeDocument.layers[0].isBackgroundLayer = false;
var workDoc = app.documents[0];
var testDoc = app.documents[1];
for (var j = workDoc.layers.length - 1; j > -1; j--) {
app.activeDocument = workDoc;
workDoc.activeLayer = app.activeDocument.layers[j];
var activeLayerName = app.activeDocument.layers[j].name;
workDoc.activeLayer.copy();
app.activeDocument = testDoc;
app.doAction("PastInPlase", "Set 1");
testDoc.activeLayer.name = activeLayerName;
loadTransparency();
testDoc.selection.fill(app.foregroundColor);
testDoc.selection.deselect();
}
testDoc.layers[testDoc.layers.length - 1].remove();
var f_l_SelectionBaund = undefined;
app.activeDocument.layers[0].blendMode = BlendMode.DIFFERENCE;
loadTransparency();
f_l_SelectionBaund = app.activeDocument.selection.bounds;
app.activeDocument.selection.deselect();
var selectionLayerBaunds = undefined;
for (var i = 1; i < app.activeDocument.layers.length; i++) {
app.activeDocument.layers[i].visible = false;
}
var needLayers = [];
for (var i = 1; i < app.activeDocument.layers.length; i++) {
app.activeDocument.layers[i].visible = true;
app.doAction("GetBlackColor", "Set 1");
try {
selectionLayerBaunds = app.activeDocument.selection.bounds;
if (selectionLayerBaunds != undefined) {
needLayers.push(app.activeDocument.layers[i].name)
}
}
catch(e){}
app.activeDocument.selection.deselect();
app.activeDocument.layers[i].visible = false;
}
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
alert(needLayers);