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

Quick copy-paste folders/layers into another file?

Community Beginner ,
May 26, 2023 May 26, 2023

Copy link to clipboard

Copied

 Hello everyone! I have some jobs that need to transfer some layers. Specifically, they have the same name. What I need to do is to copy selected layers in the files in job 1, and paste to files in job 2 (for example).

GordonCohen5285689037vro_2-1685088910493.png

I'm new to photoshop so I don't know if there is a faster way than opening each file and copying every of them. If this is possible, thank you for your help and please give me a method that can select the input and output paths (so I can customize it). If not, thank you for taking time to this post. I'm so grateful for all of your help!

 

 

TOPICS
Actions and scripting , Windows

Views

456

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
Adobe
Community Expert ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

That would seem to need Scripting – but unless you are already familiar with JavaScript this may be a bit steep (or one of the regulars find the task interesting enough to write a Script for it).  

In any case you should provide a small number of the corresponding file-pairs. 

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 31, 2023 May 31, 2023

Copy link to clipboard

Copied

Thanks for your reply and sorry for the late reply. However, due to the confidential of my job, it is difficult for me to provide the files. I can only describe with the following clip.

I also really want to learn javascript to script for (only) Photoshop, but don't know where to start or where to learn haha ^^

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
Advocate ,
May 31, 2023 May 31, 2023

Copy link to clipboard

Copied

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 31, 2023 May 31, 2023

Copy link to clipboard

Copied

That video does not seem to be clear to me, I fail to see where you duplicate the Layers (and which ones exactly) from one image to the other. 

 

What I did notice, though, is that the two corresponding images do not have the exactly same name. 

So identifying the corresponding image in the other Folder would need some checking, even if it seems fairly simple. 

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
Advocate ,
May 31, 2023 May 31, 2023

Copy link to clipboard

Copied

If these folders are the same ones you want to apply to another document, you could maybe find a workflow that (re)links a Smart Object (which would link to that one document with these folders). I forgot exact details, but research the link or relink commands for those.

Also if the folders are the same (let's say your folders contain adjustment layers), you can sometimes do it the other way around: paste just your "photo" into that file, go through some Layer Comps with an action if you like, and each time save that variation (and do that in batch).

That's in case you can keep it simple. Your docs may be complex or require the folders to stay there...

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
Advocate ,
May 31, 2023 May 31, 2023

Copy link to clipboard

Copied

If it's as simple as you are showing, I don't think you need a script.

Supposing your source files are the same for each target file (that is the question...), you could use this kind of workflow...

- have your source document opened

- copy those folders (putting them on your clipboard)

- batch an action that opens each target doc, selects the layer you want the folders to go on top of (or the top layer), and Paste. Do your stuff or just Save and Close document. Batch then opens the next one and does it all over again...

If you want to make sure your clipboard is not harmed while doing other things, then you should have the action go and copy the folders everytime in your source doc.

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
Advocate ,
May 31, 2023 May 31, 2023

Copy link to clipboard

Copied

Even doing it manually for now could be made more enjoyable by using a script like this...
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-open-a-number-of-images-but-on...

I haven't tested this particular one, but used one many years ago.

-

If you connect that script to a hotkey (or action hotkey that calls it), it can be configured so it each time saves/closes the current doc and loads the next file in a directory.  So no need to open a bunch at once, or be switching to your file manager. You'd basically be using two shortcuts and a click.

- next doc hotkey

- click where to paste

- paste

The hotkey will save and close and open the next one.

 

If the company trusts a commercial script more (or if it has extra options), maybe get this one on their dime... 😉
https://www.photoshoptools.ca/photo-workflow/autoloader/

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 ,
Jun 01, 2023 Jun 01, 2023

Copy link to clipboard

Copied

LATEST

Ultimately the task does not seem interesting enough (or explained well enough) to write a Script for Folder-selection etc. but looking for an image with the same three-digit-number in its name as the open image in a neighboring folder and duplicating all Layers to that should be done with the following. 

Screenshot 2023-06-01 at 12.36.03.pngScreenshot 2023-06-01 at 12.36.22.png

// if three-digit-number in file name and only two folders side-by-side open image from other folder with same three-digit-number in name;
// duplicate all layers to the second image;
// 2023, use it at your own risk;
if (app.documents.length > 0) {
    var myDocument = activeDocument;
    var theID = getDocumentId ();
    var theFolder = File(myDocument.fullName).parent;
    var theTopFolder = theFolder.parent;
    var theFolders = theTopFolder.getFiles(getFolders);
// the folder;
    if (theFolders.length == 2) {
        for (var m = 0; m < theFolders.length; m++) {
            var thisOne = theFolders[m];
            if (String(thisOne) != String(theFolder)) {
                var theOtherFolder = thisOne
            }
        }
    };
// the three-digit-number;
    var theString = myDocument.name;
    var theRegExp =/[^\d]\d{3}[^\d]/i;
    var theString = String(("_"+theString).match(theRegExp));
    var theShortRegExp = /\d{3}/i;
    var theNumber = theString.match(theShortRegExp);
if (theNumber != null) {
// the other file;
    var theFiles = theOtherFolder.getFiles(/.psd/);
    for (var n = 0; n < theFiles.length; n++) {
        if (theFiles[n].name.match(theNumber) != null) {
            var theOtherFile = theFiles[n]
        }
    };
if (theOtherFile) {
    var theOtherDocument = app.open(File(theOtherFile));
    var theOtherID = getDocumentId ();
////////////////////////////////////
activeDocument = myDocument;
selectAllLayers();
// duplicate;
// =======================================================
    var desc10 = new ActionDescriptor();
        var ref5 = new ActionReference();
        ref5.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
    desc10.putReference( charIDToTypeID( "null" ), ref5 );
        var ref6 = new ActionReference();
        ref6.putIdentifier( charIDToTypeID( "Dcmn" ), theOtherID );
    desc10.putReference( charIDToTypeID( "T   " ), ref6 );
    desc10.putInteger( charIDToTypeID( "Vrsn" ), 5 );
    var idIdnt = charIDToTypeID( "Idnt" );
var theResult = executeAction( charIDToTypeID( "Dplc" ), desc10, DialogModes.NO );
var theList = theResult.getList(stringIDToTypeID("ID"));
activeDocument = theOtherDocument;
}
}
};
////// filter folders //////
function getFolders (theFile) {
    if (theFile.constructor.name == "Folder") {
        return true
        };
    };
////// document id //////
function getDocumentId () {
    var ref = new ActionReference();
    ref.putProperty(stringIDToTypeID('property'), stringIDToTypeID('documentID'));
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var docDesc = executeActionGet(ref);
    return docDesc.getInteger(stringIDToTypeID("documentID"))
};
////// select all layers //////
function selectAllLayers() {
    var c2t = function (s) {
        return app.charIDToTypeID(s);
    };

    var s2t = function (s) {
        return app.stringIDToTypeID(s);
    };

    var descriptor = new ActionDescriptor();
    var descriptor2 = new ActionDescriptor();
    var reference = new ActionReference();
    var reference2 = new ActionReference();

    reference2.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
    descriptor.putReference(c2t("null"), reference2);
    executeAction(s2t("selectAllLayers"), descriptor, DialogModes.NO);
    reference.putProperty(s2t("layer"), s2t("background"));
    descriptor2.putReference(c2t("null"), reference);
    descriptor2.putEnumerated(s2t("selectionModifier"), s2t("selectionModifierType"), s2t("addToSelection"));
    descriptor2.putBoolean(s2t("makeVisible"), false);
    try {
        executeAction(s2t("select"), descriptor2, DialogModes.NO);
    } catch (e) { }
};

 

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