4 Replies Latest reply: Dec 27, 2010 10:20 AM by bsnyder175 RSS

    moving group (of layers) from one psd to another using action?

    bsnyder175 Community Member

      Is it possible to automatically transfer a group of layers that use blending modes from one psd to other files via Batch?

       

      I have ~500 jpg textures.  They each need a group of shading layers added to them from a specific psd (on top of a ton of other steps to my action that work just fine).  The quickest way to do that obviously is just to use an action and Batch Process.  However, I'm not able to find a way to transfer that group from one psd to my textures since some of the layers use blending modes.

       

      So, basically I have an action that performs a lot of different steps and the last thing I need to add to it is the ability to drag (or place) a group of layers from one psd to each individual texture in my Patch Process.

       

      What I've tried:

       

      1)  I've tried using File/Place… to insert my psd containing the group on top of the texture, but Placing a psd converts everything into a Smart Object, which ignores all of the individual layers/blending modes.

       

      2)  I've tried moving the Shading group from the Kitchen PSD into the texture file, but actions don't seem to record moving layers/groups between PSD's.

       

      3)  I've tried duplicating the shading group and making the "Destination" the texture file, but that won't work dynamically as it looks for a certain file name to duplicate the folder to.  To counter this, I thought I could immediately save the texture as "temp.psd", then run through all of the other actions, including the duplicate-to-destination function (which would find temp.psd and put the folder there).  But then I run into the issue of not being able to use the Override Save option in Batch Processing, which means I couldn't dynamically save each file with a specific naming convention.

       

      ---

       

      Does anyone have any ideas of what I could add to my action that would allow me to place the psd's group in each texture?  I'm running out ideas…maybe a script of some sort?

       

      Any help on the subject would be GREATLY appreciated.  If there's any confusion, just let me know and I'll do my best to clarify.

       

      Thanks!
      Bret

        • 1. Re: moving group (of layers) from one psd to another using action?
          c.pfaffenbichler Community Member

          Layer > Duplicate Group records, but I’m afraid it records the target document.

          So, unless someone else has more insight, I would recommend a Scripting solution for that task.

          But if you want to run a Batch you should take care to not have any other files open, as that might cause confusion.

           

          Scripting-wise something like this might work:

           

          #target photoshop
          var myDoc = app.activeDocument;
          var theLayerSetDoc = app.documents.getByName("Untitled-1");
          app.activeDocument = theLayerSetDoc;
          var theSet = theLayerSetDoc.layerSets.getByName("Group 1");
          theSet.duplicate(myDoc, ElementPlacement.PLACEATBEGINNING);
          

           

          If you want to try it correct the names of the document and the layerSet and paste the text into a new file in ExtendScript Toolkit (part of Photoshop’s installation, Applications/Utilities/Adobe Utilities/ExtendScript Toolkit CS4) and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.

          After restarting Photoshop the Script should be available under File > Scripts and can be recorded into an Action.

          This would work only if the file with the group is open and the document that should receive the group is the active one.

          • 2. Re: moving group (of layers) from one psd to another using action?
            bsnyder175 Community Member

            I apologize for the delayed response, what with the Holidays.  I hope you had a great Christmas.

             

            In regards to your solution, it worked!  Thank you!  I'm really happy with the results.  If you don't mind, could you explain each line of the script so I can better understand what's happening?  Is there also a way to have the script navigate within nested groups?  (i.e.  "Group 1>Shading" instead of just "Shading").  It looks like in order for this to work, my shading group must not be nested inside of anything any other groups, or it will error.  This really isn't a big problem because I can just drag the shading group out, but if I could have it navigate within nested group(s) to my shading group, that would be great.

             

            Thanks again!  You ROCK!

            • 3. Re: moving group (of layers) from one psd to another using action?
              c.pfaffenbichler Community Member

              I’try to annotate the Script:

               

              // tell extendscript toolkit which adobe application to target;
              #target photoshop
              // determine the document on which to work;
              var myDoc = app.activeDocument;
              // define which open document to get the layergroup from;
              // one could also open a document from a specific position on the harddrive. 
              var theLayerSetDoc = app.documents.getByName("Untitled-1");
              // switch photoshop’s focus to the group-document to be able to work with it;
              app.activeDocument = theLayerSetDoc;
              // define the group, actually one could avoid the variable and just process it directly;
              var theSet = theLayerSetDoc.layerSets.getByName("Group 1");
              // do the duplication;
              theSet.duplicate(myDoc, ElementPlacement.PLACEATBEGINNING);

              Is there also a way to have the script navigate within nested groups?  (i.e.  "Group 1>Shading" instead of just "Shading").

              Group-content is not a direct child of the document and subsequently has to be addressed via its parent, e.g. 

              var theSet = theLayerSetDoc.layerSets.getByName("Group 1").layerSets.getByName("Shading")

              • 4. Re: moving group (of layers) from one psd to another using action?
                bsnyder175 Community Member

                Fantastic, thank you so much!  The script comments were very insightful.

                 

                Thanks again!