Copy link to clipboard
Copied
is it possible to select multiple layers (with layermask) and merge them?
tell application "Adobe Photoshop CS6"
tell current document
set current layer to every layer of layer set "bloem 1-9" of layer set "Bloem"
tell current layer
merge
end tell
end tell
end tell
Copy link to clipboard
Copied
Not sure how to do this in Applescript but I understand that Applescript has a do Javascript command so this might help.
With javascript you don't have to select all the layers in a set. You just select the layerSet and merge.
app.activeDocument.activeLayer.merge(),
Copy link to clipboard
Copied
Thanks Michael,
it works great but the problem is that i lose the folder of the layers. Is it posible to merge the layers within the folder and keeping the folder?
Maurits
Copy link to clipboard
Copied
Yes, for that you have to select the layers that are in the set. Here is one way using javascript
function selectLayerBelow( add ){
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Bckw" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
if(add!=undefined && add = true )desc.putEnumerated( stringIDToTypeID('selectionModifier'), stringIDToTypeID('selectionModifierType'), stringIDToTypeID('addToSelectionContinuous') );
desc.putBoolean( charIDToTypeID( "MkVs" ), false );
executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
};
// assumes a layerSet the the activeLayer and doesn't work correctly if there are nested layerSets
var numberOfLayersInSet = app.activeDocument.activeLayer.layers.length;
selectLayerBelow();
for(var layerIndex = 1;layerIndex<numberOfLayersInSet;layerIndex++){
selectLayerBelow( true );
}
app.activeDocument.activeLayer.merge();
Copy link to clipboard
Copied
Thank you Michael!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now