Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Selecting multiple layers and merge

New Here ,
Aug 13, 2013 Aug 13, 2013

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

TOPICS
Actions and scripting
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Aug 13, 2013 Aug 13, 2013

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(),

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 14, 2013 Aug 14, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 14, 2013 Aug 14, 2013

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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 15, 2013 Aug 15, 2013
LATEST

Thank you Michael!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines