2 Replies Latest reply on Feb 2, 2010 10:03 AM by Paul Riggott

    Retrieve color of a SolidFill layer

    cy.ril.le Level 1

      Hi there,


      I'm currently trying to automatize some process we have at work, and for that I need to retrieve the color of a Solid Fill layer. I can see the layer in the hierarchy, its kind is "SOLIDFILL" accordingly, but I cannot see any property in the Javascript Guide that would allow me to retrieve which color it is.

      Thanks in advance for any pointer as I can't seem to find documentation on the web...

        • 1. Re: Retrieve color of a SolidFill layer
          Paul Riggott Level 6

          The fill layer need to be selected before running the script..

          app.backgroundColor = solidFill();
          function solidFill(){
          var ref = new ActionReference(); 
          ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
          var desc = executeActionGet(ref) 
          var adjList = desc.getList(stringIDToTypeID('adjustment')); 
          var adjDesc = adjList.getObjectValue(0); 
          var colorDesc = adjDesc.getObjectValue(stringIDToTypeID('color')); 
          var Colour = new SolidColor(); 
          Colour.rgb.red = colorDesc.getDouble(charIDToTypeID('Rd  ')); 
          Colour.rgb.green = colorDesc.getDouble(charIDToTypeID('Grn ')); 
          Colour.rgb.blue = colorDesc.getDouble(charIDToTypeID('Bl  '));
          return Colour;
          • 2. Re: Retrieve color of a SolidFill layer
            cy.ril.le Level 1

            thank — you — very — much

            for this quick reply that exactly answers my question.