5 Replies Latest reply on Oct 16, 2010 4:27 AM by E Shippers

    Altering Hue/Saturation using scripting

    E Shippers

      Hi,

       

      I can't work out how to change the hue/saturation/brigtness in photoshop using scripting (currently using applescript) - the 'adjust' command doesn't seem to work.

       

      As I'm using multi-coloured images I don't want to simply fill them with a colour.

       

      Any hints or tips really appreciated!

       

      Thanks

        • 1. Re: Altering Hue/Saturation using scripting
          Paul Riggott Level 6

          In javascript I would use this function...

          
          function HueSatLight(Hue,Sat,Light) {
              var desc9 = new ActionDescriptor();
              desc9.putBoolean( charIDToTypeID('Clrz'), false );
                  var list2 = new ActionList();
                      var desc10 = new ActionDescriptor();
                      desc10.putInteger( charIDToTypeID('H   '), Hue );
                      desc10.putInteger( charIDToTypeID('Strt'), Sat );
                      desc10.putInteger( charIDToTypeID('Lght'), Light );
                  list2.putObject( charIDToTypeID('Hst2'), desc10 );
              desc9.putList( charIDToTypeID('Adjs'), list2 );
              executeAction( charIDToTypeID('HStr'), desc9, DialogModes.NO );
          };
          
          1 person found this helpful
          • 2. Re: Altering Hue/Saturation using scripting
            Muppet Mark-QAl63s Level 4

            Hue & Saturation layer adjustments is not in the DOM for either AppleScript or JavaScript. (I have no idea as to why?) You will need to use Paul's code and pass it to the app's do javascript command…

            1 person found this helpful
            • 3. Re: Altering Hue/Saturation using scripting
              E Shippers Level 1

              I'm not quite sure how to execute the javascript function from applescript?

               

              and make it operate on the current layer of current document...

               

              I've tried this in applescript:

               

                  tell application "Adobe Photoshop CS4"
                      set myDoc to current document
                      set myLayer to current layer in myDoc
                      do javascript (file "/ Users / emmashipley / huesatlight.jsx") ¬
                          with arguments {10, 10, 10}
                  end tell

               

              and am getting this error message:

               

              Applescript error:

               

              Adobe Photoshop CS4 got an error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
              - <no additional information available>

               

              The javascript file huesatlight.jsx is saved in the path referred to so not sure why this isn't working?

               

              Thanks for the help!

              • 4. Re: Altering Hue/Saturation using scripting
                E Shippers Level 1

                it's working! the file path had spaces in.... thank you your answers :-)

                • 5. Re: Altering Hue/Saturation using scripting
                  E Shippers Level 1

                  Thanks Paul this worked a treat!