Photoshop script to copy all the layers of close PSD to open the current document

Hi, I have very limited capacity script so this task is above my pay grade

I'm looking for a script to read and copy all the layers in a PSD saved file and copy them into the current active document. The two documents have the same size and I need to be able to change text layers after copying. Anyone has any advice or examples of how I might be able to do this?

Thank you in advance for any help you can offer.

Kind regards

Marcus

Try the script in entry below. You must open the destination file, and you must put in the path and name where your source file. It will not choose a layer from background from the source file.

#target photoshop
var sFile = new File('~/desktop/template.psd');//change path to template file
var doc = activeDocument;
var sDoc = open(sFile);

var idselectAllLayers = stringIDToTypeID( "selectAllLayers" );
    var desc2 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref1.putEnumerated( idLyr, idOrdn, idTrgt );
    desc2.putReference( idnull, ref1 );
executeAction( idselectAllLayers, desc2, DialogModes.NO );

var idDplc = charIDToTypeID( "Dplc" );
    var desc5 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref2 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref2.putEnumerated( idLyr, idOrdn, idTrgt );
    desc5.putReference( idnull, ref2 );
    var idT = charIDToTypeID( "T  " );
        var ref3 = new ActionReference();
        var idDcmn = charIDToTypeID( "Dcmn" );
        ref3.putName( idDcmn, doc.name );
    desc5.putReference( idT, ref3 );
    var idVrsn = charIDToTypeID( "Vrsn" );
    desc5.putInteger( idVrsn, 5 );
    var idIdnt = charIDToTypeID( "Idnt" );
        var list1 = new ActionList();
        list1.putInteger( 3 );
        list1.putInteger( 4 );
    desc5.putList( idIdnt, list1 );
executeAction( idDplc, desc5, DialogModes.NO );

Tags: Photoshop

Similar Questions

Maybe you are looking for

  • Could not find 'show all bookmarks' or 'export' to save them, make it back to explorere?

    I use windows 7 Professional 64-bit.I find no "show all bookmarks" or "Report" to save my favorites.I've been to 'Help', clicked on the icon on the right referring and cannot see the same illustration that you want.Sadly and reluctantly, if I can't s

  • Retrieve account with no knowning it's e-mail?

    Hello.Exceed the Microsoft has severely damaged the steps get Skype.Once I lost my other (real) accounts password, I tried to recover, but he always redirected me to Hotmail password recovery. So, I am somehow in this Skype account via hotmail acc, I

  • "Now attempt to network connection.

    I need HELP... I have a Hp Photosmart Premium e-All-In-One C310a. That is the problem. (Internet) cable was disconnected, now upward, can not get the printer to connect. Everything worked fine before. As he tried to connect, it was stated that I didn

  • Deadlock in Windows Update - Windows 7 running on Boot Camp

    This is a new installation by using a product key and everything seem to be working now EXCEPT Windows Update - there's always the search. How can I get the life in it?

  • All DVD player

    Can I know how to work the dvd player function