7 Replies Latest reply on Mar 6, 2017 6:33 PM by xbytor2

    Functionality Not Available This Version PS

    C.Outwin

      Extendedscript Tooklit CC 4.0.0.1 displays "General Photoshop error occurred.  This functionality may not be available in this version of Photoshop." upon reaching the following code:

       

      var red = Math.round(color.getDouble(cTID('Rd  ')));

      Where color if of type:  color = [ActionDescriptor]

       

      I have included:

      #target photoshop

      #include "/Developer/xtools/xlib/stdlib.js"

       

      I'm a new xtools user and believe the error is caused within the "color.getDouble(cTID('Rd  ')) " portion of the statement.  I can't find these methods within xtools; so I don't know if something else should be #included.  My setup is:  Photoshop CC 2017.0.1 Release, xtools v2.3 and OS X 10.12.3.

       

      Thank you.

       

      P.S.  (My goal is to obtain the solid fill color of an adjustment layer.)

        • 1. Re: Functionality Not Available This Version PS
          maxwyss Level 4

          Can you get other error messages when you run the script from ExtendScript Toolkit in debug mode?

          • 2. Re: Functionality Not Available This Version PS
            C.Outwin Level 1

            I'm new to ExtendedScript Toolkit.  When you write "in debug mode" do you mean making use of the step over, step into, etc. buttons or is debug mode a state for toolkit that is specifically set?

             

            When using the step over button no errors occur until var red = Math.round(color.getDouble(cTID('Rd  '))); is reached.

             

            The function which contains this statement is a recent addition to my script which previously ran without error.

            • 3. Re: Functionality Not Available This Version PS
              xbytor2 Level 4

              cTID is in stdlib.js.

              getDouble is a method on ActionDescriptor. This is part of PS/JS.

              There are too possible problems.

              cTID requires exacty four character. It looks like you're ok here.

              The other problem is that the 'color' ActionDescriptor may not be and RGB color descriptor.

              Try this to see what is actually in the descriptor:

               

              var keys = Stdlib.getDescriptorKeyNames(color);

              $.writeln(keys.join(' '));

               

              It will print out the key names in the 'color' descriptor to the ESTK.

               

              Place this just above the line that is causing you problems.

              • 4. Re: Functionality Not Available This Version PS
                C.Outwin Level 1

                When I copy/paste

                     var keys = Stdlib.getDescriptorKeyNames(color);

                     $.writeln(keys.join(' '));

                 

                just above the statement

                     var red = Math.round(color.getDouble(cTID('Rd  ')));

                 

                A "PSConstants is undefined" error occurs and the script jumps to:

                 

                Stdlib.getDescriptorKeyNames = function(desc) {

                  var keys = [];

                  for (var i = 0; i < desc.count; i++) {

                    keys.push(PSConstants.reverseNameLookup(desc.getKey(i), "Key"));

                  }

                  return keys;

                };

                • 5. Re: Functionality Not Available This Version PS
                  xbytor2 Level 4

                  My bad. You'll need to add

                  #include "/Developer/xtools/xlib/PSConstants.js"

                   

                  after

                  #include "/Developer/xtools/xlib/stdlib.js"

                   

                  That should work.

                  • 6. Re: Functionality Not Available This Version PS
                    C.Outwin Level 1

                    As per your suspicion, "color' ActionDescriptor may not be and RGB color descriptor"

                     

                    var keys = Stdlib.getDescriptorKeyNames(color);

                    $.writeln(keys.join(' '));

                     

                    returns keys = [Array] Cyan, Magenta, Yellow, Black.

                     

                    Is there a way to get RGB or HSL values for each adjustment layer?  If not, how should I change

                     

                    var red = Math.round(color.getDouble(cTID('Rd  ')));

                     

                    to get the [Array] Cyan, Magenta, Yellow, Black?

                     

                    I sincerely appreciate your help and apologize for accidentally including your code in my previous reply.

                    • 7. Re: Functionality Not Available This Version PS
                      xbytor2 Level 4

                      Create a SolidColor object and assign the values into SolidColor.cmyk. You can then get the RGB values from the SolidColor.rgb.

                       

                      The array of Strings that Stdlib.getDescriptorKeyNames returns are proper names for the keys, not the ids you need to use.

                      The ids you need are cTID('Cyn '), cTID('Mgnt'),  cTID('Ylw '), and cTID('Blck').