21 Replies Latest reply on Feb 7, 2018 7:16 AM by JJMack

    Variable for Layer name and use in Actions

    Gabarito Level 1

      Hi everyone.

       

      I'm doing a sequence of numbers to show a countdown counter, in the shape of those digital clock plates.

      Like this:

       

        Contador1-segundo.gif

       

      Since there are 10 numbers and several frames of each number to do the animation, I thought about creating a sequence of actions.

      I created the actions for one number and would like to apply it to the remaining nine ones.

       

      But I came across a serious impediment: the actions use the name verbatim of each layer and do not lend themselves to be applied in the other layers.

       

      For example, I created layer 9 that will transition to layer 8.

      I made transformations in layer 9, made selections and made copies of layer 8.

      If I apply this to layer 1, of course it will not work, because the action will look for layers 9 and 8.

       

      Searching, I found references to using variables in the Image menu.

      But from what I could understand, those variables will not be useful to me.

      I was looking for something that would do the actions in layers that were referenced by variables and not by the name of each layer.

      In a manner that I only had changed the variable by its-turn layers, applying the actions generically on layers 1 and 2, then 2 and 3, and so on.

       

      Attached are a template file and my palete of Actions for colleagues to take a look at what I'm doing.

       

      Thank you for any suggestion and/or change of procedure.

      Because I'm not a Photoshop expert, I may be going down a more complicated path than I would have thought.

      Incidentally, I even ask for an opinion about the transformations that I made trying to simulate a 3-D board turn.

       

      As I said before not being an expert, it is only today that I "discovered" the 3D features of the program.

      Who knows what animation I'm trying to do would be better represented by using this feature?

       

       

      Waiting suggestions.

      Thank you.

       

      Files attached:

      Plates

      Palette

       

      ================================

      Guidance on how to use Actions:

      Open the Plates.psd file

      Perform Action "Number Only"

      Execute Action "Style 1 - Bold"

      Perform Action "Center"

      Perform Action "Detach in the middle"

      Perform Action "Make Plates"

      Perform Action "Transformation"

      --------------------------------------------------------------

        • 1. Re: Variable for Layer name and use in Actions
          JJMack Most Valuable Participant

          Actions are hard code Photoshop steps as you know.  If you want to use logic and variables you need to use Photoshop Scripting.  The best choice of supported languages is JavaScript and there is a Photoshop Scripting forum you can ask for advice in. Photoshop Scripting

          1 person found this helpful
          • 2. Re: Variable for Layer name and use in Actions
            Gabarito Level 1

            Thank you, JJMack.

             

            As you say, there is no way to apply those Actions to other layers without using scripting?

            I was trying to make some Actions to current layer, instead of using layers names, but It's not possible, I guess.

            Any idea?

            • 3. Re: Variable for Layer name and use in Actions
              Chuck Uebele Adobe Community Professional & MVP

              There is a plugin called ScriptListener that will record what you do, much like an action. I will put the code in a log file on your desk top. So it just a matter of copying the code to your script, and filling in some other commands to make sure the correct layer is selected.

              1 person found this helpful
              • 4. Re: Variable for Layer name and use in Actions
                Gabarito Level 1

                 

                 

                I suspect that 8li file is not suitable to my PS version.

                 

                 

                Also, I could find Kukurykus scripts and CodeReplacement, but I didn't understand how it works, despite his explanations.

                • 6. Re: Variable for Layer name and use in Actions
                  Gabarito Level 1

                  Sorry for the previous question.

                  I could see now that ScriptListener 13.0 is listed on Help/SystemInfo.

                  And also could find ScriptingListenerJS.log and ScriptingListenerVB.log on my Desktop.

                   

                  I'll try to understand how to deal with them and report back later.

                   

                  But if you guys could point me some direction, it would be great.

                  • 8. Re: Variable for Layer name and use in Actions
                    Chuck Uebele Adobe Community Professional & MVP

                    As you figured out, the scriptlistener plugin is automatically installed with CS6 - not so with the CC versions. You don't want to leave it installed in you plug in folder all the time, as it keeps adding to the log file, when you don't need it. There are several ways to handle this:

                     

                    1. move the file

                    2. Rename the file and put a "~" in front of the name.

                    Both these require that you restart PS before it works and stops.

                    3. install Tom Ruak's scripts to start and stop the plugin within PS - the best option in my opinion. In this case, you leave the plugin in the plugins folder all the time.

                     

                    // Turn ScriptListener on
                    // Copyright 2012.  Adobe Systems, Incorporated.  All rights reserved.
                    // The ScriptListener output can be turned on and off without having to uninstall.
                    // This one turns it on.
                    
                    // enable double clicking from the Macintosh Finder or the Windows Explorer
                    #target photoshop
                    
                    // in case we double clicked the file
                    app.bringToFront();
                    
                    var listenerID = stringIDToTypeID("AdobeScriptListener ScriptListener");
                    var keyLogID = charIDToTypeID('Log ');
                    var d = new ActionDescriptor;
                    d.putBoolean(keyLogID, true);
                    executeAction(listenerID, d, DialogModes.NO);
                    

                     

                     

                     

                    //Turn ScriptListener off 
                    // Copyright 2012.  Adobe Systems, Incorporated.  All rights reserved.
                    // The ScriptListener output can be turned on and off without having to uninstall.
                    // This one turns it off.
                    
                    // enable double clicking from the Macintosh Finder or the Windows Explorer
                    #target photoshop
                    
                    // in case we double clicked the file
                    app.bringToFront();
                    
                    var listenerID = stringIDToTypeID("AdobeScriptListener ScriptListener");
                    var keyLogID = charIDToTypeID('Log ');
                    var d = new ActionDescriptor;
                    d.putBoolean(keyLogID, false);
                    executeAction(listenerID, d, DialogModes.NO);
                    

                     

                    There are also SDKs for using extendscript - javascript would be best, as most users us that and it's cross platform. There is the tools guide that explains things that are common to all Adobe Apps that use extendscript, like creating UI's.

                     

                    https://wwwimages2.adobe.com/content/dam/acom/en/devnet/scripting/pdfs/javascript_tools_gu ide.pdf

                     

                    Then there are the Photoshop scripting guides that describe how to use extendscript in just PS.

                     

                    Adobe Photoshop Scripting

                    1 person found this helpful
                    • 9. Re: Variable for Layer name and use in Actions
                      Gabarito Level 1

                      Thank you, Chuck Uebele.

                       

                      I'm reading and trying to learn how to use that output log file to run several times and apply the same set of Actions to all 10 numbers.

                      I'm not a programmer and to write a useful script, based on those Actions, maybe using loops and conditionals is not a simple task for a newbie.

                      Thus, if you or other member here could take a look on my Actions Palette and want to play with it, writing the script code, I'd appreciate very much.

                       

                      Too many concepts I got here from you and JJMack.

                       

                      Thank you all.

                      • 10. Re: Variable for Layer name and use in Actions
                        Gabarito Level 1

                        Your suggestion of Tom Ruak's script is very good.

                        Thanks again.

                        • 11. Re: Variable for Layer name and use in Actions
                          Chuck Uebele Adobe Community Professional & MVP

                          Here's an example of using a script to run a series of actions on all the layers of a file:

                           

                          #target photoshop
                          
                          var doc = activeDocument;//sets the variable "doc" as a reference to the current active document
                          
                          //names of actions you want to run
                          var action1 = 'My first action'
                          var action2 = 'My second action'
                          var action3 = 'My third action'
                          
                          for(var i=0;i<doc.layers.length;i++){//loop to run through all layers of a file. a test could be added to check for type of layer to include or exclude
                              doc.activeLayer = doc.layers[i];//sets the current active layer starting at the top most layer.
                              myAction_1 (action1)//calls the function to run an action and puts in the action name you want to run
                              myAction_1 (action2)
                              myAction_1 (action3)
                              }
                          
                          
                          function myAction_1(actionName){ //unction to run an action.
                              var idPly = charIDToTypeID( "Ply " );
                                  var desc4 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref1 = new ActionReference();
                                      var idActn = charIDToTypeID( "Actn" );
                                      ref1.putName( idActn, actionName );//exchanged name of action for a variable that can be changed when the function is called
                                      var idASet = charIDToTypeID( "ASet" );
                                      ref1.putName( idASet, "Chuck actions" );//this would be the group name of where your actions are located
                                  desc4.putReference( idnull, ref1 );
                              executeAction( idPly, desc4, DialogModes.NO );   
                              }
                          
                          1 person found this helpful
                          • 12. Re: Variable for Layer name and use in Actions
                            Gabarito Level 1

                            I'll try your example too.

                            But my plans is to run step by step all actions and, later, try to adapt ScriptListener Log to change layer names and apply to all 10 numbers at once.

                            • 13. Re: Variable for Layer name and use in Actions
                              Gabarito Level 1

                              I think, I'm making some progress.

                              Once I'm a newbie on scripts, I could create, I mean, ScriptListener could create the following:

                               

                              // =======================================================
                              var idAdobeScriptAutomationScripts = stringIDToTypeID( "AdobeScriptAutomation Scripts" );
                                  var desc1 = new ActionDescriptor();
                                  var idjsCt = charIDToTypeID( "jsCt" );
                                  desc1.putPath( idjsCt, new File( "B:\\Meus documentos\\Downloads\\ScriptListner OFF.jsx" ) );
                                  var idjsMs = charIDToTypeID( "jsMs" );
                                  desc1.putString( idjsMs, """[ActionDescriptor]""" );
                              executeAction( idAdobeScriptAutomationScripts, desc1, DialogModes.NO );
                              
                              // =======================================================
                              var idHd = charIDToTypeID( "Hd  " );
                                  var desc2 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var list1 = new ActionList();
                                          var ref1 = new ActionReference();
                                          var idLyr = charIDToTypeID( "Lyr " );
                                          var idOrdn = charIDToTypeID( "Ordn" );
                                          var idTrgt = charIDToTypeID( "Trgt" );
                                          ref1.putEnumerated( idLyr, idOrdn, idTrgt );
                                      list1.putReference( ref1 );
                                  desc2.putList( idnull, list1 );
                              executeAction( idHd, desc2, DialogModes.NO );
                              
                              // =======================================================
                              var idShw = charIDToTypeID( "Shw " );
                                  var desc3 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var list2 = new ActionList();
                                          var ref2 = new ActionReference();
                                          var idLyr = charIDToTypeID( "Lyr " );
                                          var idOrdn = charIDToTypeID( "Ordn" );
                                          var idTrgt = charIDToTypeID( "Trgt" );
                                          ref2.putEnumerated( idLyr, idOrdn, idTrgt );
                                      list2.putReference( ref2 );
                                  desc3.putList( idnull, list2 );
                              executeAction( idShw, desc3, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc4 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref3 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref3.putProperty( idChnl, idfsel );
                                  desc4.putReference( idnull, ref3 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref4 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      ref4.putName( idChnl, "Cima" );
                                  desc4.putReference( idT, ref4 );
                              executeAction( idsetd, desc4, DialogModes.NO );
                              
                              // =======================================================
                              var idHd = charIDToTypeID( "Hd  " );
                                  var desc5 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var list3 = new ActionList();
                                          var ref5 = new ActionReference();
                                          var idLyr = charIDToTypeID( "Lyr " );
                                          var idOrdn = charIDToTypeID( "Ordn" );
                                          var idTrgt = charIDToTypeID( "Trgt" );
                                          ref5.putEnumerated( idLyr, idOrdn, idTrgt );
                                      list3.putReference( ref5 );
                                  desc5.putList( idnull, list3 );
                              executeAction( idHd, desc5, DialogModes.NO );
                              
                              // =======================================================
                              var idShw = charIDToTypeID( "Shw " );
                                  var desc6 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var list4 = new ActionList();
                                          var ref6 = new ActionReference();
                                          var idLyr = charIDToTypeID( "Lyr " );
                                          ref6.putName( idLyr, "8" );
                                      list4.putReference( ref6 );
                                  desc6.putList( idnull, list4 );
                              executeAction( idShw, desc6, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc7 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref7 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref7.putName( idLyr, "8" );
                                  desc7.putReference( idnull, ref7 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc7.putBoolean( idMkVs, false );
                              executeAction( idslct, desc7, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc8 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref8 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref8.putName( idLyr, "9 copy 4" );
                                  desc8.putReference( idnull, ref8 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc8.putBoolean( idMkVs, false );
                              executeAction( idslct, desc8, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc9 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref9 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref9.putProperty( idChnl, idfsel );
                                  desc9.putReference( idnull, ref9 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref10 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      ref10.putName( idChnl, "Cima" );
                                  desc9.putReference( idT, ref10 );
                              executeAction( idsetd, desc9, DialogModes.NO );
                              
                              // =======================================================
                              var idTrnf = charIDToTypeID( "Trnf" );
                                  var desc10 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref11 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref11.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc10.putReference( idnull, ref11 );
                                  var idFTcs = charIDToTypeID( "FTcs" );
                                  var idQCSt = charIDToTypeID( "QCSt" );
                                  var idQcsi = charIDToTypeID( "Qcsi" );
                                  desc10.putEnumerated( idFTcs, idQCSt, idQcsi );
                                  var idPstn = charIDToTypeID( "Pstn" );
                                      var desc11 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc11.putUnitDouble( idHrzn, idRlt, 300.462431 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc11.putUnitDouble( idVrtc, idRlt, 388.951367 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc10.putObject( idPstn, idPnt, desc11 );
                                  var idOfst = charIDToTypeID( "Ofst" );
                                      var desc12 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc12.putUnitDouble( idHrzn, idRlt, -0.000010 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc12.putUnitDouble( idVrtc, idRlt, 0.114738 );
                                  var idOfst = charIDToTypeID( "Ofst" );
                                  desc10.putObject( idOfst, idOfst, desc12 );
                                  var idWdth = charIDToTypeID( "Wdth" );
                                  var idPrc = charIDToTypeID( "#Prc" );
                                  desc10.putUnitDouble( idWdth, idPrc, 99.837393 );
                                  var idHght = charIDToTypeID( "Hght" );
                                  var idPrc = charIDToTypeID( "#Prc" );
                                  desc10.putUnitDouble( idHght, idPrc, 88.540682 );
                                  var idSkew = charIDToTypeID( "Skew" );
                                      var desc13 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idAng = charIDToTypeID( "#Ang" );
                                      desc13.putUnitDouble( idHrzn, idAng, -0.004757 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idAng = charIDToTypeID( "#Ang" );
                                      desc13.putUnitDouble( idVrtc, idAng, 0.000000 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc10.putObject( idSkew, idPnt, desc13 );
                                  var idUsng = charIDToTypeID( "Usng" );
                                      var desc14 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idPrc = charIDToTypeID( "#Prc" );
                                      desc14.putUnitDouble( idHrzn, idPrc, -0.000000 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idPrc = charIDToTypeID( "#Prc" );
                                      desc14.putUnitDouble( idVrtc, idPrc, 0.015930 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc10.putObject( idUsng, idPnt, desc14 );
                                  var idIntr = charIDToTypeID( "Intr" );
                                  var idIntp = charIDToTypeID( "Intp" );
                                  var idBcbc = charIDToTypeID( "Bcbc" );
                                  desc10.putEnumerated( idIntr, idIntp, idBcbc );
                              executeAction( idTrnf, desc10, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc15 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref12 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref12.putProperty( idChnl, idfsel );
                                  desc15.putReference( idnull, ref12 );
                                  var idT = charIDToTypeID( "T   " );
                                  var idOrdn = charIDToTypeID( "Ordn" );
                                  var idNone = charIDToTypeID( "None" );
                                  desc15.putEnumerated( idT, idOrdn, idNone );
                              executeAction( idsetd, desc15, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc16 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref13 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref13.putName( idLyr, "Layer 1" );
                                  desc16.putReference( idnull, ref13 );
                                  var idselectionModifier = stringIDToTypeID( "selectionModifier" );
                                  var idselectionModifierType = stringIDToTypeID( "selectionModifierType" );
                                  var idaddToSelection = stringIDToTypeID( "addToSelection" );
                                  desc16.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelection );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc16.putBoolean( idMkVs, false );
                              executeAction( idslct, desc16, DialogModes.NO );
                              
                              // =======================================================
                              var idMrgtwo = charIDToTypeID( "Mrg2" );
                                  var desc17 = new ActionDescriptor();
                              executeAction( idMrgtwo, desc17, DialogModes.NO );
                              
                              // =======================================================
                              var idHd = charIDToTypeID( "Hd  " );
                                  var desc18 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var list5 = new ActionList();
                                          var ref14 = new ActionReference();
                                          var idLyr = charIDToTypeID( "Lyr " );
                                          var idOrdn = charIDToTypeID( "Ordn" );
                                          var idTrgt = charIDToTypeID( "Trgt" );
                                          ref14.putEnumerated( idLyr, idOrdn, idTrgt );
                                      list5.putReference( ref14 );
                                  desc18.putList( idnull, list5 );
                              executeAction( idHd, desc18, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc19 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref15 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref15.putProperty( idChnl, idfsel );
                                  desc19.putReference( idnull, ref15 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref16 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      ref16.putName( idChnl, "Cima" );
                                  desc19.putReference( idT, ref16 );
                              executeAction( idsetd, desc19, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc20 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref17 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref17.putName( idLyr, "8" );
                                  desc20.putReference( idnull, ref17 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc20.putBoolean( idMkVs, false );
                              executeAction( idslct, desc20, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc21 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref18 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref18.putName( idLyr, "9 copy 3" );
                                  desc21.putReference( idnull, ref18 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc21.putBoolean( idMkVs, false );
                              executeAction( idslct, desc21, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc22 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref19 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref19.putProperty( idChnl, idfsel );
                                  desc22.putReference( idnull, ref19 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref20 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      ref20.putName( idChnl, "Cima" );
                                  desc22.putReference( idT, ref20 );
                              executeAction( idsetd, desc22, DialogModes.NO );
                              
                              // =======================================================
                              var idTrnf = charIDToTypeID( "Trnf" );
                                  var desc23 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref21 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref21.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc23.putReference( idnull, ref21 );
                                  var idFTcs = charIDToTypeID( "FTcs" );
                                  var idQCSt = charIDToTypeID( "QCSt" );
                                  var idQcsi = charIDToTypeID( "Qcsi" );
                                  desc23.putEnumerated( idFTcs, idQCSt, idQcsi );
                                  var idPstn = charIDToTypeID( "Pstn" );
                                      var desc24 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc24.putUnitDouble( idHrzn, idRlt, 300.462431 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc24.putUnitDouble( idVrtc, idRlt, 387.951492 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc23.putObject( idPstn, idPnt, desc24 );
                                  var idOfst = charIDToTypeID( "Ofst" );
                                      var desc25 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc25.putUnitDouble( idHrzn, idRlt, 0.001000 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc25.putUnitDouble( idVrtc, idRlt, -0.391377 );
                                  var idOfst = charIDToTypeID( "Ofst" );
                                  desc23.putObject( idOfst, idOfst, desc25 );
                                  var idWdth = charIDToTypeID( "Wdth" );
                                  var idPrc = charIDToTypeID( "#Prc" );
                                  desc23.putUnitDouble( idWdth, idPrc, 100.058158 );
                                  var idHght = charIDToTypeID( "Hght" );
                                  var idPrc = charIDToTypeID( "#Prc" );
                                  desc23.putUnitDouble( idHght, idPrc, 69.600548 );
                                  var idSkew = charIDToTypeID( "Skew" );
                                      var desc26 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idAng = charIDToTypeID( "#Ang" );
                                      desc26.putUnitDouble( idHrzn, idAng, 0.000455 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idAng = charIDToTypeID( "#Ang" );
                                      desc26.putUnitDouble( idVrtc, idAng, 0.000000 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc23.putObject( idSkew, idPnt, desc26 );
                                  var idUsng = charIDToTypeID( "Usng" );
                                      var desc27 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idPrc = charIDToTypeID( "#Prc" );
                                      desc27.putUnitDouble( idHrzn, idPrc, -0.000000 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idPrc = charIDToTypeID( "#Prc" );
                                      desc27.putUnitDouble( idVrtc, idPrc, 0.029278 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc23.putObject( idUsng, idPnt, desc27 );
                                  var idIntr = charIDToTypeID( "Intr" );
                                  var idIntp = charIDToTypeID( "Intp" );
                                  var idBcbc = charIDToTypeID( "Bcbc" );
                                  desc23.putEnumerated( idIntr, idIntp, idBcbc );
                              executeAction( idTrnf, desc23, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc28 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref22 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref22.putProperty( idChnl, idfsel );
                                  desc28.putReference( idnull, ref22 );
                                  var idT = charIDToTypeID( "T   " );
                                  var idOrdn = charIDToTypeID( "Ordn" );
                                  var idNone = charIDToTypeID( "None" );
                                  desc28.putEnumerated( idT, idOrdn, idNone );
                              executeAction( idsetd, desc28, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc29 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref23 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref23.putName( idLyr, "Layer 1" );
                                  desc29.putReference( idnull, ref23 );
                                  var idselectionModifier = stringIDToTypeID( "selectionModifier" );
                                  var idselectionModifierType = stringIDToTypeID( "selectionModifierType" );
                                  var idaddToSelection = stringIDToTypeID( "addToSelection" );
                                  desc29.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelection );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc29.putBoolean( idMkVs, false );
                              executeAction( idslct, desc29, DialogModes.NO );
                              
                              // =======================================================
                              var idMrgtwo = charIDToTypeID( "Mrg2" );
                                  var desc30 = new ActionDescriptor();
                              executeAction( idMrgtwo, desc30, DialogModes.NO );
                              
                              // =======================================================
                              var idHd = charIDToTypeID( "Hd  " );
                                  var desc31 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var list6 = new ActionList();
                                          var ref24 = new ActionReference();
                                          var idLyr = charIDToTypeID( "Lyr " );
                                          var idOrdn = charIDToTypeID( "Ordn" );
                                          var idTrgt = charIDToTypeID( "Trgt" );
                                          ref24.putEnumerated( idLyr, idOrdn, idTrgt );
                                      list6.putReference( ref24 );
                                  desc31.putList( idnull, list6 );
                              executeAction( idHd, desc31, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc32 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref25 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref25.putProperty( idChnl, idfsel );
                                  desc32.putReference( idnull, ref25 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref26 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      ref26.putName( idChnl, "Cima" );
                                  desc32.putReference( idT, ref26 );
                              executeAction( idsetd, desc32, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc33 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref27 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref27.putName( idLyr, "8" );
                                  desc33.putReference( idnull, ref27 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc33.putBoolean( idMkVs, false );
                              executeAction( idslct, desc33, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc34 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref28 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref28.putName( idLyr, "9 copy 2" );
                                  desc34.putReference( idnull, ref28 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc34.putBoolean( idMkVs, false );
                              executeAction( idslct, desc34, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc35 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref29 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref29.putProperty( idChnl, idfsel );
                                  desc35.putReference( idnull, ref29 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref30 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      ref30.putName( idChnl, "Cima" );
                                  desc35.putReference( idT, ref30 );
                              executeAction( idsetd, desc35, DialogModes.NO );
                              
                              // =======================================================
                              var idTrnf = charIDToTypeID( "Trnf" );
                                  var desc36 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref31 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref31.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc36.putReference( idnull, ref31 );
                                  var idFTcs = charIDToTypeID( "FTcs" );
                                  var idQCSt = charIDToTypeID( "QCSt" );
                                  var idQcsi = charIDToTypeID( "Qcsi" );
                                  desc36.putEnumerated( idFTcs, idQCSt, idQcsi );
                                  var idPstn = charIDToTypeID( "Pstn" );
                                      var desc37 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc37.putUnitDouble( idHrzn, idRlt, 300.462431 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc37.putUnitDouble( idVrtc, idRlt, 388.951367 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc36.putObject( idPstn, idPnt, desc37 );
                                  var idOfst = charIDToTypeID( "Ofst" );
                                      var desc38 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc38.putUnitDouble( idHrzn, idRlt, 0.000167 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc38.putUnitDouble( idVrtc, idRlt, -0.337637 );
                                  var idOfst = charIDToTypeID( "Ofst" );
                                  desc36.putObject( idOfst, idOfst, desc38 );
                                  var idWdth = charIDToTypeID( "Wdth" );
                                  var idPrc = charIDToTypeID( "#Prc" );
                                  desc36.putUnitDouble( idWdth, idPrc, 99.888141 );
                                  var idHght = charIDToTypeID( "Hght" );
                                  var idPrc = charIDToTypeID( "#Prc" );
                                  desc36.putUnitDouble( idHght, idPrc, 33.767872 );
                                  var idSkew = charIDToTypeID( "Skew" );
                                      var desc39 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idAng = charIDToTypeID( "#Ang" );
                                      desc39.putUnitDouble( idHrzn, idAng, -0.028376 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idAng = charIDToTypeID( "#Ang" );
                                      desc39.putUnitDouble( idVrtc, idAng, 0.000000 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc36.putObject( idSkew, idPnt, desc39 );
                                  var idUsng = charIDToTypeID( "Usng" );
                                      var desc40 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idPrc = charIDToTypeID( "#Prc" );
                                      desc40.putUnitDouble( idHrzn, idPrc, -0.000000 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idPrc = charIDToTypeID( "#Prc" );
                                      desc40.putUnitDouble( idVrtc, idPrc, 0.042057 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc36.putObject( idUsng, idPnt, desc40 );
                                  var idIntr = charIDToTypeID( "Intr" );
                                  var idIntp = charIDToTypeID( "Intp" );
                                  var idBcbc = charIDToTypeID( "Bcbc" );
                                  desc36.putEnumerated( idIntr, idIntp, idBcbc );
                              executeAction( idTrnf, desc36, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc41 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref32 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref32.putProperty( idChnl, idfsel );
                                  desc41.putReference( idnull, ref32 );
                                  var idT = charIDToTypeID( "T   " );
                                  var idOrdn = charIDToTypeID( "Ordn" );
                                  var idNone = charIDToTypeID( "None" );
                                  desc41.putEnumerated( idT, idOrdn, idNone );
                              executeAction( idsetd, desc41, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc42 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref33 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref33.putName( idLyr, "Layer 1" );
                                  desc42.putReference( idnull, ref33 );
                                  var idselectionModifier = stringIDToTypeID( "selectionModifier" );
                                  var idselectionModifierType = stringIDToTypeID( "selectionModifierType" );
                                  var idaddToSelection = stringIDToTypeID( "addToSelection" );
                                  desc42.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelection );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc42.putBoolean( idMkVs, false );
                              executeAction( idslct, desc42, DialogModes.NO );
                              
                              // =======================================================
                              var idMrgtwo = charIDToTypeID( "Mrg2" );
                                  var desc43 = new ActionDescriptor();
                              executeAction( idMrgtwo, desc43, DialogModes.NO );
                              
                              // =======================================================
                              var idHd = charIDToTypeID( "Hd  " );
                                  var desc44 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var list7 = new ActionList();
                                          var ref34 = new ActionReference();
                                          var idLyr = charIDToTypeID( "Lyr " );
                                          var idOrdn = charIDToTypeID( "Ordn" );
                                          var idTrgt = charIDToTypeID( "Trgt" );
                                          ref34.putEnumerated( idLyr, idOrdn, idTrgt );
                                      list7.putReference( ref34 );
                                  desc44.putList( idnull, list7 );
                              executeAction( idHd, desc44, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc45 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref35 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref35.putName( idLyr, "9" );
                                  desc45.putReference( idnull, ref35 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc45.putBoolean( idMkVs, false );
                              executeAction( idslct, desc45, DialogModes.NO );
                              
                              // =======================================================
                              var idDlt = charIDToTypeID( "Dlt " );
                                  var desc46 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref36 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref36.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc46.putReference( idnull, ref36 );
                              executeAction( idDlt, desc46, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idmove = charIDToTypeID( "move" );
                                  var desc47 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref37 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref37.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc47.putReference( idnull, ref37 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref38 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref38.putIndex( idLyr, 12 );
                                  desc47.putReference( idT, ref38 );
                                  var idAdjs = charIDToTypeID( "Adjs" );
                                  desc47.putBoolean( idAdjs, false );
                                  var idVrsn = charIDToTypeID( "Vrsn" );
                                  desc47.putInteger( idVrsn, 5 );
                              executeAction( idmove, desc47, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc48 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref39 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref39.putProperty( idChnl, idfsel );
                                  desc48.putReference( idnull, ref39 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref40 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      ref40.putName( idChnl, "Baixo" );
                                  desc48.putReference( idT, ref40 );
                              executeAction( idsetd, desc48, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc49 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref41 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref41.putName( idLyr, "9 copy" );
                                  desc49.putReference( idnull, ref41 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc49.putBoolean( idMkVs, false );
                              executeAction( idslct, desc49, DialogModes.NO );
                              
                              // =======================================================
                              var idCpTL = charIDToTypeID( "CpTL" );
                              executeAction( idCpTL, undefined, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc50 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref42 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref42.putName( idLyr, "8 copy" );
                                  desc50.putReference( idnull, ref42 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc50.putBoolean( idMkVs, false );
                              executeAction( idslct, desc50, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc51 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref43 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref43.putProperty( idChnl, idfsel );
                                  desc51.putReference( idnull, ref43 );
                                  var idT = charIDToTypeID( "T   " );
                                      var ref44 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      ref44.putName( idChnl, "Baixo" );
                                  desc51.putReference( idT, ref44 );
                              executeAction( idsetd, desc51, DialogModes.NO );
                              
                              // =======================================================
                              var idTrnf = charIDToTypeID( "Trnf" );
                                  var desc52 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref45 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref45.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc52.putReference( idnull, ref45 );
                                  var idFTcs = charIDToTypeID( "FTcs" );
                                  var idQCSt = charIDToTypeID( "QCSt" );
                                  var idQcsi = charIDToTypeID( "Qcsi" );
                                  desc52.putEnumerated( idFTcs, idQCSt, idQcsi );
                                  var idPstn = charIDToTypeID( "Pstn" );
                                      var desc53 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc53.putUnitDouble( idHrzn, idRlt, 300.462431 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc53.putUnitDouble( idVrtc, idRlt, 409.948741 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc52.putObject( idPstn, idPnt, desc53 );
                                  var idOfst = charIDToTypeID( "Ofst" );
                                      var desc54 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc54.putUnitDouble( idHrzn, idRlt, 0.000000 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idRlt = charIDToTypeID( "#Rlt" );
                                      desc54.putUnitDouble( idVrtc, idRlt, 0.000000 );
                                  var idOfst = charIDToTypeID( "Ofst" );
                                  desc52.putObject( idOfst, idOfst, desc54 );
                                  var idWdth = charIDToTypeID( "Wdth" );
                                  var idPrc = charIDToTypeID( "#Prc" );
                                  desc52.putUnitDouble( idWdth, idPrc, 99.924370 );
                                  var idHght = charIDToTypeID( "Hght" );
                                  var idPrc = charIDToTypeID( "#Prc" );
                                  desc52.putUnitDouble( idHght, idPrc, 43.445378 );
                                  var idSkew = charIDToTypeID( "Skew" );
                                      var desc55 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idAng = charIDToTypeID( "#Ang" );
                                      desc55.putUnitDouble( idHrzn, idAng, 0.009548 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idAng = charIDToTypeID( "#Ang" );
                                      desc55.putUnitDouble( idVrtc, idAng, 0.000000 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc52.putObject( idSkew, idPnt, desc55 );
                                  var idUsng = charIDToTypeID( "Usng" );
                                      var desc56 = new ActionDescriptor();
                                      var idHrzn = charIDToTypeID( "Hrzn" );
                                      var idPrc = charIDToTypeID( "#Prc" );
                                      desc56.putUnitDouble( idHrzn, idPrc, -0.000000 );
                                      var idVrtc = charIDToTypeID( "Vrtc" );
                                      var idPrc = charIDToTypeID( "#Prc" );
                                      desc56.putUnitDouble( idVrtc, idPrc, -0.037036 );
                                  var idPnt = charIDToTypeID( "Pnt " );
                                  desc52.putObject( idUsng, idPnt, desc56 );
                                  var idIntr = charIDToTypeID( "Intr" );
                                  var idIntp = charIDToTypeID( "Intp" );
                                  var idBcbc = charIDToTypeID( "Bcbc" );
                                  desc52.putEnumerated( idIntr, idIntp, idBcbc );
                              executeAction( idTrnf, desc52, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc57 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref46 = new ActionReference();
                                      var idChnl = charIDToTypeID( "Chnl" );
                                      var idfsel = charIDToTypeID( "fsel" );
                                      ref46.putProperty( idChnl, idfsel );
                                  desc57.putReference( idnull, ref46 );
                                  var idT = charIDToTypeID( "T   " );
                                  var idOrdn = charIDToTypeID( "Ordn" );
                                  var idNone = charIDToTypeID( "None" );
                                  desc57.putEnumerated( idT, idOrdn, idNone );
                              executeAction( idsetd, desc57, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc58 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref47 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref47.putName( idLyr, "Layer 1" );
                                  desc58.putReference( idnull, ref47 );
                                  var idselectionModifier = stringIDToTypeID( "selectionModifier" );
                                  var idselectionModifierType = stringIDToTypeID( "selectionModifierType" );
                                  var idaddToSelection = stringIDToTypeID( "addToSelection" );
                                  desc58.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelection );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc58.putBoolean( idMkVs, false );
                              executeAction( idslct, desc58, DialogModes.NO );
                              
                              // =======================================================
                              var idMrgtwo = charIDToTypeID( "Mrg2" );
                                  var desc59 = new ActionDescriptor();
                              executeAction( idMrgtwo, desc59, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc60 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref48 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref48.putName( idLyr, "9 copy" );
                                  desc60.putReference( idnull, ref48 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc60.putBoolean( idMkVs, false );
                              executeAction( idslct, desc60, DialogModes.NO );
                              
                              // =======================================================
                              var idDlt = charIDToTypeID( "Dlt " );
                                  var desc61 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref49 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref49.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc61.putReference( idnull, ref49 );
                              executeAction( idDlt, desc61, DialogModes.NO );
                              
                              // =======================================================
                              var idHd = charIDToTypeID( "Hd  " );
                                  var desc62 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var list8 = new ActionList();
                                          var ref50 = new ActionReference();
                                          var idLyr = charIDToTypeID( "Lyr " );
                                          ref50.putName( idLyr, "8 copy" );
                                      list8.putReference( ref50 );
                                  desc62.putList( idnull, list8 );
                              executeAction( idHd, desc62, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc63 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref51 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref51.putName( idLyr, "8 copy" );
                                  desc63.putReference( idnull, ref51 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc63.putBoolean( idMkVs, false );
                              executeAction( idslct, desc63, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc64 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref52 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref52.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc64.putReference( idnull, ref52 );
                                  var idT = charIDToTypeID( "T   " );
                                      var desc65 = new ActionDescriptor();
                                      var idNm = charIDToTypeID( "Nm  " );
                                      desc65.putString( idNm, """91""" );
                                  var idLyr = charIDToTypeID( "Lyr " );
                                  desc64.putObject( idT, idLyr, desc65 );
                              executeAction( idsetd, desc64, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc66 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref53 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref53.putName( idLyr, "9 copy 2" );
                                  desc66.putReference( idnull, ref53 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc66.putBoolean( idMkVs, false );
                              executeAction( idslct, desc66, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc67 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref54 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref54.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc67.putReference( idnull, ref54 );
                                  var idT = charIDToTypeID( "T   " );
                                      var desc68 = new ActionDescriptor();
                                      var idNm = charIDToTypeID( "Nm  " );
                                      desc68.putString( idNm, """92""" );
                                  var idLyr = charIDToTypeID( "Lyr " );
                                  desc67.putObject( idT, idLyr, desc68 );
                              executeAction( idsetd, desc67, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc69 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref55 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref55.putName( idLyr, "9 copy 3" );
                                  desc69.putReference( idnull, ref55 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc69.putBoolean( idMkVs, false );
                              executeAction( idslct, desc69, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc70 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref56 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref56.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc70.putReference( idnull, ref56 );
                                  var idT = charIDToTypeID( "T   " );
                                      var desc71 = new ActionDescriptor();
                                      var idNm = charIDToTypeID( "Nm  " );
                                      desc71.putString( idNm, """93""" );
                                  var idLyr = charIDToTypeID( "Lyr " );
                                  desc70.putObject( idT, idLyr, desc71 );
                              executeAction( idsetd, desc70, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc72 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref57 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref57.putName( idLyr, "9 copy 4" );
                                  desc72.putReference( idnull, ref57 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc72.putBoolean( idMkVs, false );
                              executeAction( idslct, desc72, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc73 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref58 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref58.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc73.putReference( idnull, ref58 );
                                  var idT = charIDToTypeID( "T   " );
                                      var desc74 = new ActionDescriptor();
                                      var idNm = charIDToTypeID( "Nm  " );
                                      desc74.putString( idNm, """94""" );
                                  var idLyr = charIDToTypeID( "Lyr " );
                                  desc73.putObject( idT, idLyr, desc74 );
                              executeAction( idsetd, desc73, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc75 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref59 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref59.putName( idLyr, "9 copy 5" );
                                  desc75.putReference( idnull, ref59 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc75.putBoolean( idMkVs, false );
                              executeAction( idslct, desc75, DialogModes.NO );
                              
                              // =======================================================
                              var idsetd = charIDToTypeID( "setd" );
                                  var desc76 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref60 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      var idOrdn = charIDToTypeID( "Ordn" );
                                      var idTrgt = charIDToTypeID( "Trgt" );
                                      ref60.putEnumerated( idLyr, idOrdn, idTrgt );
                                  desc76.putReference( idnull, ref60 );
                                  var idT = charIDToTypeID( "T   " );
                                      var desc77 = new ActionDescriptor();
                                      var idNm = charIDToTypeID( "Nm  " );
                                      desc77.putString( idNm, """95""" );
                                  var idLyr = charIDToTypeID( "Lyr " );
                                  desc76.putObject( idT, idLyr, desc77 );
                              executeAction( idsetd, desc76, DialogModes.NO );
                              
                              // =======================================================
                              var idslct = charIDToTypeID( "slct" );
                                  var desc78 = new ActionDescriptor();
                                  var idnull = charIDToTypeID( "null" );
                                      var ref61 = new ActionReference();
                                      var idLyr = charIDToTypeID( "Lyr " );
                                      ref61.putName( idLyr, "8" );
                                  desc78.putReference( idnull, ref61 );
                                  var idMkVs = charIDToTypeID( "MkVs" );
                                  desc78.putBoolean( idMkVs, false );
                              executeAction( idslct, desc78, DialogModes.NO );
                              

                               

                              Above script is working without error and can make the first set of plates, number 9 to 8.

                               

                              I have few questions:

                              1 - How to put ScriptListenerON and OFF as a menu item of PS GUI?

                              2 - Variable desc starts by 1. Can I delete some actions, leaving absents of numbers among the entire code?

                               

                              After fix all things, I'll copy this block of code and change layers name to make all nine remaining numbers.

                               

                              Note: I realized that moving layer position is also absolut number, not logical.

                              I mean, if I have 10 layers and move layer "2" to layer "3" position, PS move by position considering not the layer name.

                               

                              Still studying...

                              • 14. Re: Variable for Layer name and use in Actions
                                JJMack Most Valuable Participant

                                Gabarito  wrote

                                 

                                I think, I'm making some progress.

                                Once I'm a newbie on scripts, I could create, I mean, ScriptListener could create the following:

                                 

                                I have few questions:

                                1 - How to put ScriptListenerON and OFF as a menu item of PS GUI?

                                2 - Variable desc starts by 1. Can I delete some actions, leaving absents of numbers among the entire code?

                                 

                                After fix all things, I'll copy this block of code and change layers name to make all nine remaining numbers.

                                 

                                Note: I realized that moving layer position is also absolut number, not logical.

                                I mean, if I have 10 layers and move layer "2" to layer "3" position, PS move by position considering not the layer name.

                                 

                                Still studying...

                                1.) How to put ScriptListenerON and OFF as a menu item of PS GUI?

                                There is no such feature.   On My Windows Machines I control the scriptlistener plug-in ON/OFF via a little Command line window running a Windows BAT file.

                                I did create a Photoshop Palette using the JSX Launcher extension but had some minor issues.  You most like could create an Photoshop extension to control the scriptlistener.   For me it would be an be a worth while effort to learn How to create and extension panel and code the extension.  When the Bat file has been doing all I need for years.

                                Capture.jpg

                                 

                                2.) Scriptlistener Code isis like recorded Action steps. All variables are hard coded there is no logic in the script code.  Its Step Step Step just like actions.  However,  you can add logic to Action manager code and you can program functions from action manager code where you change some of the variable use to be set from variable you pass the function

                                1 person found this helpful
                                • 15. Re: Variable for Layer name and use in Actions
                                  Gabarito Level 1

                                  Very interesting your BAT file to control ScriptListener.

                                  I wrote it down and run.

                                  Before that, I was using tip from Chuck Uebele about Tom Ruak's script to turn ON and OFF.

                                  Had to go to File/Scripts/Browse... every time.

                                   

                                  To control Actions Palette, I copy "Actions Palette.psp" file to "%USERPROFILE%\AppData\Roaming\Adobe\Adobe Photoshop CS6\Adobe Photoshop CS6 Settings" folder, replacing the previous one, for each session. I have some sets of them with different tasks saved.

                                   

                                  Later, I'll try to change layer names and move positions on script file to check if it works.

                                  I'll report back.

                                  • 16. Re: Variable for Layer name and use in Actions
                                    Gabarito Level 1

                                    Editing script, I'm changing layer names and move position in a way to achieve what I want: transform all plates with numbers to make an animation.

                                    Script is working as expected.

                                     

                                     

                                    I may say the thread is solved.

                                     

                                    But my solution is very ugly because I have to copy a block with 983 lines for each plate number.

                                    And adjust variables like layer name and move position among too many javascript commands and other variables.

                                    That is leading me to get a final script with almost 10,000 lines!

                                     

                                    So, I ask collegues if someone know how to use loops and conditionals to work with just one block, like this:

                                     

                                    number := 9
                                    while number >= 0 do
                                         TransformLayer(number)
                                         AdjustLayerPosition(number)
                                         dec(number)
                                    end while
                                    

                                    (LayerPosition is when I have to move layers)

                                     

                                    This way, I'd have just one block of code and no needs to adjust each single variable.

                                     

                                    I realized that I can reuse the same name for variables desc and ref, created by ScriptListener without problem.

                                    Higher numbers are desc78 and ref61.

                                     

                                    Because the whole code is very big, I won't copy it here.

                                    But you can have a look in almost a half of it here (numbers 9, 8, 7 and 6).

                                    • 17. Re: Variable for Layer name and use in Actions
                                      Chuck Uebele Adobe Community Professional & MVP

                                      While loops can be tricky in that if something goes wrong, the keep going forever. Best to use a for loop. Like this if you want to cycle through the layers, which will only loop the number of layers in the document.

                                       

                                      var doc = activeDocument;
                                      for(var i = 0;i<doc.layers.length;i++){
                                           //your code here
                                           }
                                      

                                       

                                      There are lots of ways to keep track of the layers, id numbers, names, etc. You can push all the layers into an array to keep tract of them if they are moved:

                                       

                                      var doc = activeDocument;
                                      var layerArray = new Array()
                                      var doc = activeDocument;
                                      for(var i = 0;i<doc.layers.length;i++){
                                           layerArray.push(doc.layers[i]);
                                           }
                                      
                                      //Then you can reference the layers by their original order:
                                      
                                      doc.activeLayer = layerArray[3];
                                      

                                       

                                      The action manager code produces a lot of junk code so make sure you copy only the code that you really need. You can replace the variables in the code by using functions that replace the values of the variables. Lets say you want to do the same thing to many different layers. Using the above code that put the layers into an array, you could do this, which keeps the amount of repetitive code to a minimum :

                                       

                                      doSomthing(layerArray[2])
                                      
                                      function doSomething(setLayer){//setLayer is given the value of layerArray[2] when it's call in line 1
                                           doc.activeLayer = setLayer
                                           //other code here
                                           }
                                      
                                      1 person found this helpful
                                      • 18. Re: Variable for Layer name and use in Actions
                                        Gabarito Level 1

                                        Yes, I'm cleaning what is unnecessary.

                                         

                                        About advices for advanced programming, using arrays, for loops and keep track of all other variables and so on, I'm afraid it is beyond my skills and needs.

                                        I could make a functional script that is doing fine the job.

                                         

                                        For those who want to test and play, there is a template here.

                                        And script for numbers from 9 to 1 is here.

                                        Just to open the template and run the script.

                                         

                                        I want to say thanks to the valuable mates who helped me with my questions.

                                        Although the final solution is not too much elegant nor pretty, with loops and nested procedures, it's working very well.

                                        It's enough.

                                         

                                        So, we can consider the thread fully SOLVED.

                                         

                                        Thank you all.

                                         

                                        • 19. Re: Variable for Layer name and use in Actions
                                          PECourtejoie Adobe Community Professional

                                          hello!

                                          WOW WOW WOW!

                                          There was no need for scripting AT ALL!

                                          When you craft your action, use the select next or previous layer shortcuts, instead of clicking on them, as it would search for layers with that exact name...

                                          Alt +] or Alt +[ was your simpler answer...

                                          • 20. Re: Variable for Layer name and use in Actions
                                            JJMack Most Valuable Participant

                                            There problem is not so much targeting layers.  They want to add a sequence of layers for a number  like 0 through 9 to create a frame animation. If they created  an action to add the sequence of layers they would need to play that action 10 times and be able to pass the number the sequence should be created for and the action would need to create different layer content for each number pass.  The reason the scripting is the tool to use is Actions can not use logic for process like that.

                                             

                                            The layer sequece also require the number the prior number and the following number  here is his sequence in revers. A count up sequence.

                                            ero.gifOnce.gifForever.gif

                                            • 21. Re: Variable for Layer name and use in Actions
                                              JJMack Most Valuable Participant

                                              And double digits would complicate things digits would need to flip and pause else look like this.

                                              2sec.gifForever.gif