9 Replies Latest reply on Oct 15, 2012 11:09 PM by c.pfaffenbichler

    Adjustment Layers

    mangalarajiv

      Hi,

       

      How to create a new vibrance adjustment layer through scripting and how to apply values on it ?

       

      thanks,

      rajiv.s

        • 1. Re: Adjustment Layers
          Michael L Hale Level 5

          The scriptlistener plug-in that ships with Photoshop can give you the code you need. It looks something like this( the first creates the layer, the second set the values ).

          // =======================================================
          var idMk = charIDToTypeID( "Mk  " );
              var desc37 = new ActionDescriptor();
              var idnull = charIDToTypeID( "null" );
                  var ref32 = new ActionReference();
                  var idAdjL = charIDToTypeID( "AdjL" );
                  ref32.putClass( idAdjL );
              desc37.putReference( idnull, ref32 );
              var idUsng = charIDToTypeID( "Usng" );
                  var desc38 = new ActionDescriptor();
                  var idType = charIDToTypeID( "Type" );
                  var idvibrance = stringIDToTypeID( "vibrance" );
                  desc38.putClass( idType, idvibrance );
              var idAdjL = charIDToTypeID( "AdjL" );
              desc37.putObject( idUsng, idAdjL, desc38 );
          executeAction( idMk, desc37, DialogModes.NO );
          
          // =======================================================
          var idsetd = charIDToTypeID( "setd" );
              var desc39 = new ActionDescriptor();
              var idnull = charIDToTypeID( "null" );
                  var ref33 = new ActionReference();
                  var idAdjL = charIDToTypeID( "AdjL" );
                  var idOrdn = charIDToTypeID( "Ordn" );
                  var idTrgt = charIDToTypeID( "Trgt" );
                  ref33.putEnumerated( idAdjL, idOrdn, idTrgt );
              desc39.putReference( idnull, ref33 );
              var idT = charIDToTypeID( "T   " );
                  var desc40 = new ActionDescriptor();
                  var idvibrance = stringIDToTypeID( "vibrance" );
                  desc40.putInteger( idvibrance, 55 );
                  var idStrt = charIDToTypeID( "Strt" );
                  desc40.putInteger( idStrt, 13 );
              var idvibrance = stringIDToTypeID( "vibrance" );
              desc39.putObject( idT, idvibrance, desc40 );
          executeAction( idsetd, desc39, DialogModes.NO );
          
          • 2. Re: Adjustment Layers
            mangalarajiv Level 1

            How to create a new selective color adjustment layer through scripting and how to apply values on it ?

            Isn't there any way to make that apart from recording the step by Script Listener?

             

            thanks,

            rajiv.s

            • 3. Re: Adjustment Layers
              Michael L Hale Level 5

              No, the only layers you can create without Action Manager( scriptlistener ) are normal art layers and text layers.

              • 4. Re: Adjustment Layers
                mangalarajiv Level 1

                How to create a new selective color adjustment layer through scripting and how to apply values on it ?

                 

                Could you please help me on this

                 

                thanks,

                rajiv.s

                • 5. Re: Adjustment Layers
                  c.pfaffenbichler Level 9

                  Have you bothered trying to record the creation of such Layers with ScriptingListener yet?

                  • 6. Re: Adjustment Layers
                    mangalarajiv Level 1

                    Hi,

                     

                    No. I didn't bother about to try recoding, when i create adjustment layer, it can be recorded by script listener. when i applied values, it does n't recording it. Could you please tell me why it is not recording?

                     

                    That is the issue, i requested you all to get my requirement.

                     

                    thanks,

                    rajiv.s

                    • 7. Re: Adjustment Layers
                      c.pfaffenbichler Level 9

                      I may be misunderstanding your post …

                      Is it that you are not ending the editing step (by selecting another layer for example) and therefore don’t get the recording?

                       

                      If you have the Action Manager code for creating and editing of a particular type of Adjustment Layer you can wrap that in a function that takes the intended values as arguments and replace the originally entered values with those.

                      • 8. Re: Adjustment Layers
                        Michael L Hale Level 5

                        I have experienced scriptlistener not recording changes made in the adjustment panel. I have several work-arounds.

                         

                        1. If you have access to an older version that doesn't have the adjustment panel( CS3?) use that version to get the scriptlistener code. This is the best way to get changes to adjustment layers.

                         

                        2. Start a new temp action and record your changes. That sometimes forces the changed to be recorded in the log. If not you can use Xbytor's ActionFileToJavascript.jsx to get the code. After you get the code you can delete the action.

                         

                        3. Select a different layer, re-select the adjustment layer and double click on the adjustment icon for that layer. That will open the adjustment panel( without you selecting it ). This also seems to force the change to be recorded in the log.

                         

                        As to your requirements, selective color has a lot of options. You should create your own code using the settings you want to change.

                        • 9. Re: Adjustment Layers
                          c.pfaffenbichler Level 9

                          I have experienced scriptlistener not recording changes made in the adjustment panel.

                          Actually I have had that happen, too, but I think that may have been with CS4 for me.