Get clipped layers
function clippingMaskLayers() { // Gets the clipping masked layers to the activeLayer
app.runMenuItem( stringIDToTypeID('groupLayersEvent') );
var group = app.activeDocument.activeLayer,
groupLength = group.layers.length,
clippingmask = groupLength > 1 ? true : false,
collectedLayers = [];
if ( clippingmask ) {
for ( var i=0; i < groupLength-1; i++ ) { // Remove "-1" to get the base layer too
collectedLayers.push( group.layers[i] );
}
}
executeAction( charIDToTypeID('undo'), undefined, DialogModes.NO );
if ( clippingmask ) { return collectedLayers; } else { return false; }
}