2 Replies Latest reply on Nov 2, 2014 1:42 PM by Chris Panny

    Photoshop CS6 - How can javaScript fill blank layer with color?

    Chris Panny Level 1



      I'm a production artist and I work with PSD files that were created in Adobe Scene7 Image Authoring Tool. These PSDs contain a background layer along with 1-20 alpha channels. My script has to make new blank layers based on the number of alpha channels and then it has to fill the new layers with light gray. The RGB values are 161, 161, 161. I checked the PSCS6 JavaScript Reference pdf, but I don't see a method that would do this for artLayers. (Let me also say that I'm new to javaScript).


      Does anyone know how to fill a blank layer with these RGB values?


      Here's my script so far:


      #target photoshop 


      // declare variable to contain the active document

      var myDoc=app.activeDocument;


      // declare variable to contain the number of alpha channels, excluding the RGB channels

      var alphaChan = myDoc.channels.length - 3;


      // create loop to make new layers based on number of alpha channels and fill each layer with gray

      for (a=0; a<alphaChan; a=+1){



      if (myDoc.artLayers.length == (alphaChan + 1)) {