Skip to main content
This topic has been closed for replies.

2 replies

Stephen Marsh
Community Expert
Community Expert
January 16, 2022

Copy source layer to clipboard, then select the destination layer/s and run this script (does not work with non-pixel layers):

 

/*
Paste Clipboard to Multiple Selected Layers.jsx
Stephen Marsh, v1.0 - 16th January 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/paste-on-multiple-layers-at-once/td-p/12673987
NOTES:
Copy source layer to clipboard, then select the destination layer/s and run this script (does not work with non-pixel layers)
*/

#target photoshop

/***** Process Selected Layers from Jazz-y *****/
var s2t = stringIDToTypeID;
(r = new ActionReference).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var lrs = executeActionGet(r).getList(p),
    sel = new ActionReference();
for (var i = 0; i < lrs.count; i++) {
    sel.putIdentifier(s2t('layer'), p = lrs.getReference(i).getIdentifier(s2t('layerID')));
    (r = new ActionReference).putIdentifier(s2t('layer'), p);
    (d = new ActionDescriptor()).putReference(s2t("target"), r);
    executeAction(s2t('select'), d, DialogModes.NO);
/***** Process Selected Layers from Jazz-y *****/
    
    if (app.activeDocument.activeLayer.kind == LayerKind.NORMAL) {

        // Select All
        app.activeDocument.selection.selectAll();

        // Paste In Place
        var idpaste = stringIDToTypeID("paste");
        var desc1571 = new ActionDescriptor();
        var idinPlace = stringIDToTypeID("inPlace");
        desc1571.putBoolean(idinPlace, true);
        var idantiAlias = stringIDToTypeID("antiAlias");
        var idantiAliasType = stringIDToTypeID("antiAliasType");
        var idantiAliasNone = stringIDToTypeID("antiAliasNone");
        desc1571.putEnumerated(idantiAlias, idantiAliasType, idantiAliasNone);
        var idas = stringIDToTypeID("as");
        var idpixel = stringIDToTypeID("pixel");
        desc1571.putClass(idas, idpixel);
        executeAction(idpaste, desc1571, DialogModes.NO);

        // Merge Down
        var idmergeLayersNew = stringIDToTypeID("mergeLayersNew");
        var desc1573 = new ActionDescriptor();
        executeAction(idmergeLayersNew, desc1573, DialogModes.NO);

        // Deselect
        app.activeDocument.selection.deselect();

    } else {
        alert('The selected layer is not a "normal" pixel layer')
    }
}

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

?...
?...Author
Inspiring
January 16, 2022

.

Stephen Marsh
Community Expert
Community Expert
January 16, 2022

@?... wrote:

Okay thank you! Could you possibly give me a visual as to where I'm taking that though? I'm just not quite sure where I'm supposed to paste. You also say "select the destination layers," could you elaborate on that too please? I honestly can't tell if I know what that's referring to.


 

You don't paste, the script does that for you to the multiple selected layers.

 

Step 1: Select/target/activate the layer and copy to the clipboard:

Here Layer 2 is the source, Layer 0 & Layer 1 will be the destination/target layers

 

Step 2: Select/target/activate Layer 0 & Layer 1

Layer 0 & Layer 1 selected/targeted/activated

 

Step 3: Run the script

Layer 0 & Layer 1 now have the copied content from Layer 2

John Waller
Community Expert
Community Expert
January 15, 2022