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

Can you select multiple layers in a document and have them all duplicate to unique documents

Community Beginner ,
May 21, 2022 May 21, 2022

Copy link to clipboard

Copied

Say I have multiple layers in a document. I right click a layer, go to duplicate, select new document. Is there a way to select multiple layers, and then duplicate them to *unique* documents? As in, I select 4 layers, and I duplicate them all at once to 4 new documents?

TOPICS
Windows

Views

216

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , May 22, 2022 May 22, 2022

@CottonandTwirls – As I think about this, an action might be able to do so, however, it would be messy... Here is a script that should achieve what you are looking for:

 

/* 
https://community.adobe.com/t5/photoshop-ecosystem-discussions/can-you-select-multiple-layers-in-a-document-and-have-them-all-duplicate-to-unique-documents/td-p/12957700
Dupe Selected Layers to New Docs.jsx
v1.0 - Stephen Marsh, 22nd May 2022
Note: No checks are performed for the selected layer kind, ensure that the correct
...

Votes

Translate

Translate
Adobe
Community Expert ,
May 21, 2022 May 21, 2022

Copy link to clipboard

Copied

Hi, you can use the move tool to do this use the auto-select option then you can select all layers by selecting them from the main working area then control + j to duplicate them at once...regards

Ali Sajjad / Graphic Design Trainer / Freelancer / Adobe Certified Professional

Votes

Translate

Translate

Report

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
Community Expert ,
May 22, 2022 May 22, 2022

Copy link to clipboard

Copied

@CottonandTwirls - yes, this is possible with scripting.

 

@lambiloon - how does this dupe to separate individual documents?

 

Votes

Translate

Translate

Report

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
Community Expert ,
May 22, 2022 May 22, 2022

Copy link to clipboard

Copied

Only with script as suggested by @Stephen_A_Marsh, there isn't built in functionality as far as I know.

Votes

Translate

Translate

Report

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
Community Expert ,
May 22, 2022 May 22, 2022

Copy link to clipboard

Copied

@CottonandTwirls – As I think about this, an action might be able to do so, however, it would be messy... Here is a script that should achieve what you are looking for:

 

/* 
https://community.adobe.com/t5/photoshop-ecosystem-discussions/can-you-select-multiple-layers-in-a-document-and-have-them-all-duplicate-to-unique-documents/td-p/12957700
Dupe Selected Layers to New Docs.jsx
v1.0 - Stephen Marsh, 22nd May 2022
Note: No checks are performed for the selected layer kind, ensure that the correct layers are selected!
*/

#target photoshop

function main() {

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

            // Set the parent doc
            var origDoc = activeDocument;

            // RegEx remove illegal filename characters from document name
            var docName = activeDocument.activeLayer.name.replace(/[:\/\\*\?\"\<\>\|\\\r\\\n.]/g, ""); // "/\:*?"<>|\r\n" -> "-";

            // Layer name
            var layerName = activeDocument.activeLayer.name;

            // Show only the current layer
            toggleActiveLayerVisibility(true);

            // Duplicate the current layer to a new doc
            dupeLayer();

            // Return to the parent doc
            activeDocument = origDoc;

        }


        /* Functions */

        // Dupe active layer to new doc
        function dupeLayer() {
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var descriptor = new ActionDescriptor();
            var reference = new ActionReference();
            var reference2 = new ActionReference();
            reference.putClass(s2t("document"));
            descriptor.putReference(s2t("null"), reference);
            // Duped document name
            descriptor.putString(s2t("name"), docName);
            reference2.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
            descriptor.putReference(s2t("using"), reference2);
            // Duped layer name
            descriptor.putString(s2t("layerName"), layerName);
            descriptor.putInteger(s2t("version"), 0);
            executeAction(s2t("make"), descriptor, DialogModes.NO);
        }

        // Toggle active layer visibility
        function toggleActiveLayerVisibility(toggleOptionsPalette) {
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var descriptor = new ActionDescriptor();
            var list = new ActionList();
            var reference = new ActionReference();
            reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
            list.putReference(reference);
            descriptor.putList(s2t("null"), list);
            descriptor.putBoolean(s2t("toggleOptionsPalette"), toggleOptionsPalette);
            executeAction(s2t("show"), descriptor, DialogModes.NO);
        }
}

app.activeDocument.suspendHistory("Dupe Selected Layers to New Docs.jsx", "main()");

 

Saving & Installing Scripts:

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save the text file as .txt
  5. Rename the file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)

 

More here:

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

 

Votes

Translate

Translate

Report

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
Community Beginner ,
May 22, 2022 May 22, 2022

Copy link to clipboard

Copied

Stephen I cannot express my gratitute enough to you for the various scripts you've written that have saved me literally HOURS of work. I just started using your rename-multiple-layers-at-once script last week and I went around and told every single person I know who uses Photoshop where to find it lol. Thank you, once again. This works perfectly. 

Votes

Translate

Translate

Report

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
Community Expert ,
May 22, 2022 May 22, 2022

Copy link to clipboard

Copied

LATEST

@CottonandTwirls – You're welcome, I'd like to think that I am helping to pay back to the community in the same spirit in which others have helped me.

Votes

Translate

Translate

Report

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