Apply new color to layers

Hello!
I would like to create a script in javascript  for Photoshop CC that does the following:
1) Check each layer in the current document
2) If the layer is named "fillMe" then color it in a specific color but lock the transparent pixels (in German it's called "Transparente Pixel fixieren")
I imagine that there might be several ways to go about this. Maybe applying a "Color Overlay" layer style with the desired color would work.
I have tried to find a good solution but cannot find any information on how to lock the pixel transparency with code. Also I would like to access a color picker window for the color selection.
Could you kindly direct me to the right tutorials/resources?
Thank you in advance!
Edit: So far I have got this with the help of the Script Listener, but it won't run as "this function might not be available in the new version of Photoshop"
function showBounds(layerNode) {   
    for (var i=0; i<layerNode.length; i++) {
        showBounds(layerNode[i].layerSets);
        for(var layerIndex=0; layerIndex < layerNode[i].artLayers.length; layerIndex++) {
            var layer=layerNode[i].artLayers[layerIndex];
            if (layer.name == "fillMe") {
                layer.visible = 1;
                layer.transparentPixelsLocked = 1;
                var idFl = charIDToTypeID( "Fl  " );
                var desc8 = new ActionDescriptor();
                var idUsng = charIDToTypeID( "Usng" );
                var idFlCn = charIDToTypeID( "FlCn" );
                var idFrgC = charIDToTypeID( "FrgC" );
                desc8.putEnumerated( idUsng, idFlCn, idFrgC );
                executeAction( idFl, desc8, DialogModes.NO );
showBounds(app.activeDocument.layerSets);

Hi, thank you for your help!
However, I'm having problems running the script. The first time it runs on a photoshop file it works fine, deletes all Color Overlay styles from "fillMe" layers and fills the according layers with the foreground color.
When it runs a second time it always stops with the prompt "The command 'delete layer style' is momentarily not available" (or the German counterpart to that sentence).
I tried to incorporate your code into mine, but I don't know what I'm doing wrong...
function recolor(layerNode) {   
    for (var i=0; i<layerNode.length; i++) {
        recolor(layerNode[i].layerSets);
        for(var layerIndex=0; layerIndex < layerNode[i].artLayers.length; layerIndex++) {
            var layer=layerNode[i].artLayers[layerIndex];
            if (layer.name == "fillMe") {
                layer.visible = 1;
                layer.transparentPixelsLocked = 1;
                app.activeDocument.activeLayer = layer;
                var ref = new ActionReference();
                ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
                var layerDesc = executeActionGet(ref);
                if (layerDesc.hasKey(stringIDToTypeID('layerEffects')) == true) {
                    delColOverlay();
                fillWithNewColor();
                app.runMenuItem(stringIDToTypeID('selectNoLayers'));
function fillWithNewColor(){
    var idFl = charIDToTypeID( "Fl  " );
    var desc137 = new ActionDescriptor();
    var idUsng = charIDToTypeID( "Usng" );
    var idFlCn = charIDToTypeID( "FlCn" );
    var idFrgC = charIDToTypeID( "FrgC" );
    desc137.putEnumerated( idUsng, idFlCn, idFrgC );
    executeAction( idFl, desc137, DialogModes.ALL );
function delColOverlay(){
    var iddsfx = charIDToTypeID( "dsfx" );
    var desc173 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
    var ref77 = new ActionReference();
    var idSoFi = charIDToTypeID( "SoFi" );
    ref77.putClass( idSoFi );
    var idLyr = charIDToTypeID( "Lyr " );
    var idOrdn = charIDToTypeID( "Ordn" );
    var idTrgt = charIDToTypeID( "Trgt" );
    ref77.putEnumerated( idLyr, idOrdn, idTrgt );
    desc173.putReference( idnull, ref77 );
    executeAction( iddsfx, desc173, DialogModes.ALL );   
recolor(app.activeDocument.layerSets);

Similar Messages

  • [AS] CS3- Find any text with style, then replace that text with a new applied fill color.

    I am trying to find the simplest way in cs3 to find any text with style, then replace that text with a new fill color. I can find text and change text. I can find a style and change it to a new style. I can't seem to find a style and change the applied fill color. I do not want to change the properties of the style, just the applied color. Yes, I want the + sign, for now. I know, why not update the style, I am not allowed to. Any help would be great. Since the search is not available, I need a new response.
    Thanks.

    You can work around the bug by just doing a find, then looping through the<br />results, changing the color one at a time. It'll be a fraction slower, but<br />should do the trick:<br /><br />tell application "Adobe InDesign CS3"<br />    set find text preferences to nothing<br />    set properties of find text preferences to {applied paragraph style:"The<br />name"}<br />    set theFinds to find text document 1<br />    repeat with i from 1 to count of theFinds<br />        set properties of item i of theFinds to {fill color:"Replace color"}<br />    end repeat<br />end tell<br /><br />The bug is fixed in CS4, BTW.<br /><br />-- <br />Shane Stanley <[email protected]><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>

  • Adjustment Layer staying white and won't apply its effects to layering video?

    Adjustment Layer staying white and won't apply its effects to layering video?
    I was using adjustment layers for color correcting and now my adjustment layer is just staying white and I've looked at so many forums and i can't find what I'm doing wrong...
    I reset my preferences, I made a new project I'm clueless.

    That is After Effects but ..try openig the composition window (TAB)
    You are looking at the AL in Footage Window.

  • How to apply a color to a greyscale linked image?

    I have an old file that I've been working on that another designer started. She had these black and white linked images in there with colors applied to them. Currently, you can click on them with the direct selection tool and see the color that is applied in the "fill" box on the toolbar. But when I tried to place that same image into the document myself, there is no option to apply a color. What did she do to make it possible to apply these colors? I'm using Indesign CS6, by the way.
    Anyone know?
    Thanks!
    ~ Sarah

    Hey Daniel & Mikey,
    Thanks for your responses, but I'm still stuck with my same problem. I should have explained better - what I really need to do most here is relink the exact same file that the old designer was already using. I've moved files around and now the linked needs to be relinked. When I relink the exact same file that was working fine with the color applied before, I run into the same problem again. I cannot direct-select it and change the color of it. It's just not an option. This also happens if I create a new InDesign file and place that file in and try to do it fresh. She did something to that file to make it take a color, but I can't figure out what it might be!
    Maybe some visuals will help me to explain...
    This is the problem layer below. Let's call it "background". It's at 100% opacity, layer effect set on multiply in BOTH examples.
    Here's how I want it to look. There are a few layers in here to create this effect. When I click on "background" with the selection tool, I do not see a color applied. However, if I click on it with the direct selection tool, you can see that a yellow color has been applied.
    Now, when I relink the file (or place it myself), this is the result I get. You can see that "background" has reverted back to its greyscale state. When I try to select it once more with the direct selection tool, all the colors are greyed out and I can't apply a color.
    Anyone know the answer to this puzzle?
    Thanks!

  • How can i view and apply new custom patterns without going to preset manager? i had this facility but have now lost it

    how can i view and apply new custom patterns without going to preset manager? i had this facility but have now lost it.  i design patterns but am fairly new to photoshop. i used to be able to click on the drop down menu in patterns in the 'fill' box but cannot now do this.  have i inadvertently clicked on something to turn this facility off?  i now have to go to 'preset manager' and manually move my new design to the first box and click 'done' so that i can use it.

    Which version of photoshop are you using?
    After you define a custom pattern it should be added to the bottom of whatever patterns are already loaded.
    For example, if you define a custom pattern and then go to Edit>Fill>Pattern, the newly defined pattern should have been added to the existing loaded patterns.

  • How can I create a new color in the calendar?

    Good day,
    I wanted the to create a new color in the default calendar from Apple, but I do not know how that goes.
    Perhaps someone can explain to me how this works.
    I would be very grateful for any advice.

    If you mean you want to change a color of a calendar category or create a new one, you cannot do that, what is pre-loaded is what you get and cannot be edited.

  • How do I find the new colors in Pantone Formula guide in InDesign CC?

    It seems like the Pantone library in InDesign is not updated. I can't find the newly added colors from the Formula guide I just bought. (pantone solid coated/uncoated)
    For examle color 2248. Where do I find the new colors and how do I add them to my colorpanel?
    I hope there is someone who can help me with this!

    Check this discussion it may help
    http://forums.adobe.com/message/5737194#5737194

  • How to apply background color to link button in Flex 2

    I need to apply background color to link button as the Rollover color has  on its over event.How is this possible in Flex 2 ?I am using the above  in Xcelsius as custom component so if I apply graphics and draw rect  method it does not have any effect.Please help.

    These might help:
    http://jdevadf.oracle.com/adf-richclient-demo/components/skinningKeys/column.jspx
    http://jdevadf.oracle.com/adf-richclient-demo/components/skinningKeys/table.jspx

  • Why does CS6 InDesign Book epub output generate and apply new graf and character style names in CSS?

    I created an InDesign book composed of documents that had had no paragraph or character styles in the palettes until text was copied over from a single overall document. I worked absolutely as clean as I could.
    I synchronized the book to that single overall document several times, including immediately before exporting the book to epub. My export settings disallowed any local formatting. Character styles were restricted to one named "Italic" for which the only format applied was Italic in the Font Style field, and one named "Small Caps" for which NO formatting was included in the character style.
    There was, as far as I can see, no reason for any character or paragraph styles to export to anything but identically-named CSS entries. That is to say, any text with the character style "Italic" applied in the InDesign doc should have output with the same text with a span class entry of "Italic" around it.
    I still ended up with p and span CSS entries with extra numbers appended to them:
    span.Italic {
    font-style:italic;
    font-weight:normal;}
    span.Small-Caps-1 {
    font-variant:normal;}
    span.Italic-1 {
    font-style:italic;
    font-weight:normal;}
    span.Small-Caps-2 {
    font-variant:normal;}
    span.Italic-2 {font-style:italic;
    font-weight:normal;}
    span.Small-Caps-3 {
    font-variant:normal;}
    span.Italic-3 {
    font-style:italic;
    font-weight:normal;}
    and
    p.x-SECTION-BREAK, p.x-SECTION-BREAK-1, p.x-SECTION-BREAK-2, p.x-SECTION-BREAK-3  and so on.
    Why would the InDesign epub output engine choose to generate and apply new spans and paragraph-level styles, which multiply the complexity of editing the CSS directly? How can I prevent InDesign from doing this?

    Perhaps I wasn't clear. When I wrote "an InDesign book composed of documents that had had no paragraph or character styles in the palettes until text was copied over from a single overall document" I meant to emphasize  the part where I CLEARLY said "UNTIL text was copied over." The text I copied over had plenty of paragraph styles. I was trying to point out that each individual document had no PREVIOUSLY EXISTING character or paragraph styles that might have added complexity to the epub output. .
    So, every paragraph in each document had a paragraph style attached, a total of maybe 20 different paragraph styles throughout the book. The only CHARACTER LEVEL styles I cared about exporting were Italic, for text that was set in italic, and Small Caps, for CAPITALIZED text that I wanted to be able to make smaller in the CSS, since I am not allowed to embed fonts and therefore have no other way of creating small caps in the xhtml files inside the epub.
    So, given that I had two character styles applied to various bits of text throughout my InDesign book ("Italic" and "Small Caps"), I would like to know why there are multiple CSS entries generated: Italic, Italic-1, Italic-2, Small Caps, Small Caps-1, Small Caps-2, and so on.
    Ditto paragraph styles. I had a paragraph style called "SECTION BREAK" in each document. Not only did paragraph style "SECTION BREAK" contain identical specs in each document--I know they did because I copied each from one single doc where they were being used identically--but I also synchronized the book repeatedly.  So why would the xhtml docs and the CSS output need p.x-SECTION-BREAK-1, p.x-SECTION-BREAK-2, and p.x-SECTION-BREAK-3?

  • In Dreamweaver 6, I created a new fluid layout. I set up (4) DIVs. In the 3rd div, I changed the font color. The new color shows up on the website when viewed in my computer desktop, but, when viewed in a tablet and a cell phone, the color of the font doe

    In Dreamweaver 6, I created a new fluid layout. I set up (4) DIVs. In the 3rd div, I changed the font color. The new color shows up on the website when viewed in my computer desktop, but, when viewed in a tablet and a cell phone, the color of the font does not change. It's the same in Dreamweaver's Live view. It shows the new color on Desktop view and not in the cell phone or tablet view. Also, I changed the font itself in one of the DIVs and it shows up in the new font on the desktop view and website viewed thru the computer, but, not on the tablet or cell phone. Can someone please explain. I want to be able to change the fonts and colors for viewing in the tablet and cell phone, also. The fonts were all standard fonts. Sans-erif and Verdana and Arial were tried. Thanks.

    I will lock this discussion because of duplicate post.

  • How can i apply different color for each cell in jlist component?

    hi guys i need your help and sorry if my english is very bad..guys how can i apply different colors for each cell in jlist component? for example for the first cell i want to apply color blue, for the second cell i want red, etc... i need your answer guys tnx..
    Edited by: ryrene on Mar 21, 2010 12:13 AM

    ryrene wrote:
    hi guys i need your help and sorry if my english is very bad.
    ..guys how can i apply different colors for each cell in jlist component? for example for the first cell i want to apply color blue, for the second cell i want red, etc... i need your answer guys tnx..I'll see your tnx, and raise you dve bmbrs & nplm.

  • Illustrator CS4 New Color Swatches Keep Shifting Values

    Hi.  I really need some help.  I created 8 major panel designs for my first-ever tee shirts.  For this project, I added up to 70+ colors to my existing standard CMYK swatch library, by naming them and marking them for global.  Just to be on the safe side, I also made up my own directory in a separate document by making squares with their names next to them.  I transferred these to each new document I created.  I did all of this in Illustrator 10.
    I finally got to upgrade several months ago to the Design Suite CS4 -  Hooray!  No problem in converting my files.  I am having my tees printed in the direct-digital-to-fabric method.  My printer said that I could change all my CMYK colors to RGB for a more vibrant rendering.  And so I went in to each of my colors and manually changed them to RGB.  I also changed my document format to RGB.
    Several weeks ago, my eye registered that my favorite red didn't seem as red any more.  And so it wasn't!  I checked my swatch, and it was way off my original settings.  So I changed them.  The change didn't keep.  It turns out that almost all of my colors were off their original CMYK settings!
    So I started over again, by taking each color, and in most cases, making up a new color swatch with a slightly revised name.  I made sure the colors reflected accurately both the CMYK and the RGB percentages.  I DID NOT want to select as a spot color.  Therefore, I kept the "Process" format, but selected RGB.  I also deleted the old color swatch.
    But the problem was still there -- within a span of several minutes, my "Red" changed both in the CMYK and RGB percentages,  I checked 15 other colors I had just created, and their percentages were off also.
    Needless to say, it is very important to me that my colors hold their value.
    I thank you in advance for considering my challenge.
    Kelly Greenlee
    [email protected]

    Kelly,
    And so I went in to each of my colors and manually changed them to RGB.  I also changed my document format to RGB.
    Pick (almost) any colour in a document with CMYK Color Mode, copy into a document with RGB Color Mode, and see a change.
    In other words: if you want to keep the colours, keep the colour mode; if you want to change the colour mode, recreate the colours, and expect some differences.
    My printer said that I could change all my CMYK colors to RGB for a more vibrant rendering.
    Maybe your printer needs a vibrant rendering, with a boot.
    If the meaning was that the RGB colour gamut is larger, and therefore capable of more, and more vibrant, colours, which is true, that is what should have been said. It would imply creating new, fresh colours.

  • No color on my new COLOR ipod

    Why is there no color on my new color ipod?? The screen is EXACTLY like the old version.

    Both Dave W. and Redmoskito are right. The Best Buy salesman gave me a non-color ipod, but they exchanged it right away (but it was thirty dollars more expensive). Thanks for everyone's feedback!

  • LaserJet 2605dn washed out colors with new color cartridges

    I loaded the 3 new color cartridges, the black still has ink.  Now when I print, the colors are washed out .  I calibrated color and ran the cleaning utility.  Strangely, the demo print page with the bright blue and orange looks just fine.  I investigated further and found that printing from Adobe is okay.  So it looks like I only have the problem when I'm printing from MS Office applications.  Any ideas?  It was working fine yesterday, before the toner change.

    Hi Thomas,
    With my iP8500 I leave it on, so it appears to be specifically the behavior of the Pro9000. I did a little more testing last night as I recently re-calibrated my system, and have another method you can try. Instead of turning off "Black Point Compensation" which can leave photos with lots of shadow detail a bit too dark, open up the "Printer Settings" window and go to the color management options. The only thing you can change here is the brightness setting. Change it from Normal to Dark, leaving BPC turned on. I think you'll be pleased with the results. Good luck!

  • Where can i find new colors for background and letter fonts??

    Where can i find new color background and letter fonts??

    These are only in US sizes, not metric, but offer exactly what you want and are high quality:
    http://www.stocklayout.com
    Peter

Maybe you are looking for

  • How to detect key board event

    HI, How to detect keyboard event (Like CTRL key press shift key press) in Swing�any can any body suggest classes and interface for that�. Thanks

  • PHP Recordset error

    When I create a recordset in php it creats a function GetSQLValueString, which I assume is normal, the problem occurs when I want to edit that Recordset every time I do it recreates that function so then I have 2 and so on and so forth. Deleting the

  • Enabling VoiceOver after restoring your iPhone with iTunes doesn't work

    Yesterday, I was having a problem with my iPhone 3GS and successfully got it resolved by restoring it with iTunes 10.2. Everything went fine. However, after restoring it, I went to set up the device as new (after backing up the iPhone before restorin

  • CiscoWorks LMS 3.2 Not sending mail

    HI, I have got a CiscoWorks LMS which is not sending mail for HUM reports. Here's the log that I receive when it is supposed to send the mail in smtp.log [ Sun Oct 16 13:17:42 CAT 2011 ] INFO   [MailUtility : isMailServerWorking]  : The mail server [

  • Same package for different teams?

    Hi, we have several customers in the same enviroment/domain and we don´t want to create 4 different Photoshop CC packages (packaged exactly the same with Creative Cloud Packager). If we use CCP with an generic Adobe Account and package these apps for