6 Replies Latest reply on Mar 11, 2010 9:59 AM by stackoverflower

    Copy text layer to new document

    stackoverflower

      Hello.

       

      I'm looking for way to copy text layer (with all its effects) to a new doument, using script.

       

      Thanks in advance.

        • 1. Re: Copy text layer to new document
          Michael L Hale Level 5

          There are several ways to do something like that. If you want the new doc to be the same size as the doc the layer is in now the easiest way is to use scriptlistner.

           

          function dupelayerToNewDoc( name ) {// works with activeLayer
              var desc21 = new ActionDescriptor();
                  var ref14 = new ActionReference();
                  ref14.putClass( charIDToTypeID('Dcmn') );
              desc21.putReference( charIDToTypeID('null'), ref14 );
              desc21.putString( charIDToTypeID('Nm  '), name );
                  var ref15 = new ActionReference();
                  ref15.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
              desc21.putReference( charIDToTypeID('Usng'), ref15 );
              executeAction( charIDToTypeID('Mk  '), desc21, DialogModes.NO );
          
          
          1 person found this helpful
          • 2. Re: Copy text layer to new document
            Reynolds (Mark) Level 4

            Scripting is not necessary for this. Just Control click on any layer or group of layers (mac) or righr click (PC). Choose 'Duplicate Layer…'  - in the dialog under Document choose "New".

             

            This can be recorded as an Action and done at much more speed with the press of an F key.

             

            Picture 20.png

            • 3. Re: Copy text layer to new document
              Michael L Hale Level 5

              Mark, I have to ask again why you are in the scripting forun if you don't find scripts useful?

               

              The OP asked how to copy a layer to a new doc using scripting, not the GUI.

              • 4. Re: Copy text layer to new document
                Reynolds (Mark) Level 4
                Mark, I have to ask again why you are in the scripting forun if you don't find scripts useful?

                Because I find it tremendously irritating that people, who have not made the simple investment required to learn Photoshop properly, are so easily decieved into thinking that Scripting is necessary for simple tasks. Without it ever occuring to them "since this is  Photoshop 11, maybe have built this in already, maybe I better look" - and since most of it has been available since Photoshop 5, it's even more irritating.

                 

                I have to ask again

                Don't believe anyone ever asked this;… but thanks for the concern. Once again Actions are faster to run, and much easier to manage than Scripts.

                • 5. Re: Copy text layer to new document
                  stackoverflower Level 1

                  Mark, I'm generating the all output using script. That why touching the GUI is not even an consideration.

                   

                  About the question, a found it more easy to open the doucument and manipulate it itself than just unsaved it and reopen for new operatoin, instead of copy the layers to a new document.

                  • 6. Re: Copy text layer to new document
                    Reynolds (Mark) Level 4
                    Mark, I'm generating the all output using script.

                    Ahh… why are you doing this? could be wrong of course, but "generating all output" normally would suggest simple non-conditional operations.