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

Hello,
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){
myDoc.artLayers.add();
if (myDoc.artLayers.length == (alphaChan + 1)) {
    break;

var color = new SolidColor();
color.rgb.red = 161;
color.rgb.green = 161;
color.rgb.blue= 161;
myDoc.selection.fill(color);

Similar Messages

  • Illustrator Script: How can I duplicate a layer ( with sublayers ) with javascript code ?

    Dear All
    I want to duplicate a layer structure, as the "Duplicate Layer" submenu do with Javascript code, but I can't.
    I can duplicate only PageItems or selected object, but no Layers.
    Anybody knows how can I do it ?

    Thanks for your answer.
    #target illustrator 
    var docRef = app.activeDocument; 
    var ln = 'Layer 1'; 
    var ol = docRef.layers.getByName(ln); 
    var nl = docRef.layers.add(); 
    nl.name = ln+' Copy'; 
    for (var a = ol.pageItems.length-1; a >= 0; a--) { 
        ol.pageItems[a].duplicate(nl, ElementPlacement.PLACEATBEGINNING); 
    The problem with this code is, that it can't duplicate also the sublayers, and the sublayer elements.
    Sure I can write a recursive function, but I think there should exist a duplicate function somewhere ( for Photoshop script exist ! ) or a small trick, but I can't find it.
    Thanks

  • [CS6] How can I move shapes (created with paths)?

    [CS6]
    I created shapes with the pen tool.
    Then I selected the path selection tool and selected a path.
    Clicked right mouse key, choosed "Fill Path..." or "Fill Subpath"
    (don't know what it means). After filling with a color I get an object in
    the form of the path and I can move the path to another place.
    But I can't move the object in the shape of the path.
    I can't move it with "Path selection tool" because it's no path.
    Then I tried the "Move Tool" but I also can't select the object with it
    instead the whole canvas is moving.
    How can I select and move shapes which were
    created with the pen tool?

    You've drawn a Path then filled a region of a pixel layer.
    To make Shape layers, use the Pen Tool in "Shape" mode set in the Options bar.
    If you really do want to draw a Path and use it to create moveable pixel shape then do the fill with an empty layer targeted.

  • How can I 'fill free space with songs' AND keep some memory free?

    I like the 'automatically fill free space with songs' option, but it leaves me with no room (or very little room) for taking photos and video.  How can I keep some memory free?
    Matthew

    You'll probably need to backup or clone the remaining OS X partition, definitely clone the bootcamp partition then erase and reformat the drive. You'll need a 3rd party app.
    Check out this thread:
    https://discussions.apple.com/message/9076113#9076113

  • How can I fill a JComboBox with a ResultSet?

    I want to fill a JComboBox with the data in ResultSet. What�s the better way to do this? Can I convert a RecordSet to a Vector and use the vector in JComboBox constructor?
    Thanks for any help.
    Renato

    Prova cosi:
    myComboBox = new JComboBox();
    ArrayList items = new ArrayList();
    ResultSet result = conn.executeQuery("SELECT BLABLA FROM BLABLA");
    while (result.next())
    items.add(result.getString(1));
    result.close();
    myComboBox.setModel(new DefaultComboBoxModel(items.toArray()));
    E' molto pi� efficiente che aggiungere gli item alla combo uno alla volta.
    G.M.

  • How can I create a Tree with Color Picker icons?

    I'm a newbie to Flex. I want to create a tree which has color
    picker icons.
    As an analogy for the Mac users out there, I envision a
    control like the Calendars section in iCal, where you can specify
    the color for each individual node. These colors are then used in
    other parts of the application.
    The Flex 3 documentation specifies four methods for setting
    node icons on a Tree control, none of which seems to suit my needs:
    -The folderOpenIcon, folderClosedIcon, and defaultLeafIcon
    properties
    -Data provider node icon fields
    -The setItemIcon() method
    -The iconFunction property
    In other words, I want to "setItemIcon" to an mx:ColorPicker,
    if that makes any sense.
    Is there a standard way of doing this? If not, how can I go
    about implementing such a control? Thanks in advance!

    well, Network UI should be used.

  • How can I fill a path with a grid?

    Hi,
    I'm trying to fill some text that has been converted to outlines with a grid pattern (like graph paper). I need the grid to be made up of paths. Is this possible?

    Yes this is possible. This is a little easier with live text as all you have to do is select the 2 elements and do a CMD 7 (Mask). When your text is outlines select the text only, and do a command 8 (make compound), as an additional step prior.

  • How do I fill a paragraph with color in Pages 5?

    I recall a feature in previous versions of Pages which allowed a color (or texture) fill of a paragraph.  Is this feature missing from the new Pages 5.2?
    I do find the fill feature for a Text Box, and the color options for text, but not  paragraphs.  At least it's not obvious in the Inspector, is it hiding somewhere on a sub menu?
    Thanks for your help.
    George

    A useful artifact in Pages ’09, but not in Pages v5.2. Select your paragraph text. Use the Character Fill Color option from the included screen grab.
    If you want to place a color behind the entire paragraph block, and not just the text:
    Format > Text > Layout > Background Color gives the following:

  • Keyboard shortcut for filling layer with color are opposite on my PS CS6 OSX install, Help?

    Hello all,
    I'm a bit of a noob, and following a tutorial….and found something strange and wonder if you might help me figure what's happening.
    I have Photoshop Extended CS6 on a macbook pro (late 2011).
    I'm running OSX v 10.7.5
    I'm following along and the instructor added a new layer. I did this.
    He then filled the layer with white which is his background color (he has black foreground, white background). I have the same fore/background colors.
    Now, I thought on mac that to fill with foreground color you hit Apple+Delete  and to fill with background you hit Option+Delete
    It is doing the exact OPPOSITE for me. I hit Apple+Delete (or even backspace)  and it fills with my background color which is white
    If I hit Option+Delete (or backspace) it fills with my foreground color.
    I've tried looking in the Edit Keyboard shortcuts area…but I don't see these settings anywhere.
    I do have an external keyboard  hooked to my mac. It is a 3rd party one, but seems to work in ever other way normally.
    Keyboard here is:  http://pckeyboard.com/page/UKBD/UB40P4A
    Any suggestions why my keyboard shortcut for filling a layer with color might be reversed?
    Thanks in advance,
    CC

    eartho wrote:
    option-delete is, and always has been, fill with foreground.
    a 1 second google search would have informed you of this.
    Thanks for the reply.
    I did do a Google and I got this:
    http://blog.coghillcartooning.com/84/tip-keyboard-shortcut-to-fill-a-photoshop-layer-or-se lection-with-the-background-or-foreground-color/
    And from that I got the option-delete was background, and apple-delete was foreground.
    Hence my confusion...
    Thanks for the reply, I guess I should check 2-3 sites each time I google for keyboard shortcuts for PS.
    CC

  • How can I fill a pdf form with Excel?

    I have a pdf form and a set of Excel dates. How can I fill the form with this dates?
    Is there any way to transform excel dates into a fdf-File?
    Thank You for helping
    Hans

    I see. That's possible, in theory, but it requires using a complicated custom-made script.
    I would suggest using that Mail Merge option that's available in some versions of Excel to produce multiple single-page files, then flatten all of them (using an Action), and then merge them to a single file, to achieve the same result with much less effort.

  • Filling an outline with color

    I'm using Illustrator CC.  When I draw an outline with either the pencil tool or the paintbrush tool, I can't fill it in with color, even though the path appears to be closed.  The "fill" square has a red diagonal line through it and won't switch to a color.  Any help would be appreciated.
    Thanks,  Ann

    Red slash is nothing to worry about, that just means measn fill of none.
    Make sure you have the path selected, and then try using the appearance palette instead to fill. You can either click on the arrow and do a dropdown as in the screenshot. Or as you can see the fill is highlighted (light blue running in back of the word Fill) and then click on a swatch in swatches.
    You can also double lcikc on the pencil tool, adn enable fille new pencil strokes.
    which will then use your fill and stroke colors.

  • How can I convert a layer into a smart object with Adobe Photoshop Elements 10?

    How can I convert a layer into a smart object with Adobe Photoshop Elements 10?

    That feature is only in PS. Elements as you buy it has only limited support for smart objects. If you use File>Place to add something to your image it will come in as a smart object (within the limits to which PSE understands smart layers). However, if you know someone who can write an action for you in PS you can install it in PSE, or you could look into something like elements+ from simplephotoshop.com.

  • Using Mac computer and InDesign CS6, version 8.0, how can I fill a box from swatches?

    Using Mac computer and InDesign CS6, version 8.0, how can I fill a box from swatches?

    Make sure the Fill color proxy (solid square, upper left corner of the swatches panel) is selected and in front, then choose a swatch.

  • How can I fill mask with pattern?

    Hi
    Would you please help me? How can a add pattern to a mask? I drew a motion mask on video clip and now I want to fill it with pattern that I made in Photoshop and saved as PSD, what should I do? How can I fill mask with specific pattern?
    Thanks for any help

    AE doesn't directly support a pattern-fill like PS, so here's a workaround (as Mylenium suggested):
    Create a PS document and create a layer filled with the pattern required.
    Import the layer/PSD to AE and place in timeline.
    Place a copy of the masked layer above the Pattern layer.
    On the pattern layer, set the Track Matte to Alpha Matte.
    Read more here:
    http://livedocs.adobe.com/en_US/AfterEffects/8.0/WS3878526689cb91655866c1103906c6dea-7cf9. html

  • How do i transform a layer with maintain aspect ratio through scripting in Photoshop?

    Hi,
         How do i transform a layer with maintain aspect ratio through scripting in Photoshop? I am expecting your reply.
    thanks,
    Rajiv.s

    I don't think your talking apples to apples.  First I do not know of any Maintain Aspect Ratio icon in Photoshop. The only icon I think associated with transform is the anchor point icon in the option bar for transform. I think you may referring to the constrain check box in the image size dialog which you can check when resample is checked. Image size effect all layers in the document and the documents canvas size. The document canvas size will be changed to the values in the images size dialog and all layers will be transformed by percentage the canvas was changes while maintaining the layers position over the canvas and the layers I think may be cropped so only pixels over the canvas remain.
    I do not know if you know that layers can be any size and have aspect ratios different then the documents canvas.
    In your case it sounds like your describing a template that has a canvas size that is 2000px wide be 3000px high a 2:3 portrait aspect ratio.  Your image file has a landscape aspect. If you place that image into your template place would by default transform the image so the image would fit within the 2000px by 3000px canvas size there would be a white border top and bottom.  You could transform that smart object layer to it actual pixels size activeDocument.activeLayer.resize(100,100, AnchorPosition.MIDDLECENTER); then calculate the size you want to transform its height to. By retrieving the canvas size and the layers boundaries. Divide the canvas height pixel size by the layers pixel height size should give you the percentage you need to use. Make sure you set the ruler units to pixels so your working with pixel values for the canvas and layer size values. The resulting layer will be larger then canvas size keeping the anchor point centered will result in the canvas size masking off both sides.  In effect cropping you landscape to a portrait.  Note cropping a image from one orientation to the other changes the composition drastically.
    If your trying to make a composit like collage you may want to look at my Photoshop Collage Toolkit it will fit images to fill a 2000px by 3000px area http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.html
    You could also do centered 2:3 crop that is resized to a 3000px

Maybe you are looking for