How do I get the Photoshop layer tags in JavaScript?

I asked this question at graphic design stack exchange but they pointed me here:
http://graphicdesign.stackexchange.com/questions/35374/how-do-i-get-the-photoshop-layer-ta gs-in-javascript?noredirect=1#comment48962_35374
I want to do actions based on the tagged layer color (these thing 1) in Photoshop. I can't find a property inside the JavaScript documentation or the ExtendScript Toolkit that might contain the value.
I'd prefer not to abuse the name for that, the layer tags look like a very clean solution to my problem. If only I could fetch them.
Any Ideas?
Kind Regards,
Mii

Hi, these functions will select all your layers with the specified color:
use the command: selectAllByColor("red");
function getIDXwithsameColor(TheColor){// search and return a list of indexes for the layers with the specified color
    var ref = new ActionReference();
    var toRet = [];
    try{activeDocument.backgroundLayer;var a=0 }catch(e){ var a = 1; };
    while(true){
      ref = new ActionReference();
      ref.putIndex( charIDToTypeID( 'Lyr ' ), a );
      try{var desc = executeActionGet(ref);}catch(err){break;}
        var cl = desc.getEnumerationValue(charIDToTypeID("Clr "));
        cl = typeIDToStringID(cl);
        var ls = desc.getEnumerationValue(stringIDToTypeID("layerSection"));
        ls = typeIDToStringID(ls);
        if(ls != 'layerSectionEnd'){
          if(cl == TheColor){
            toRet.push(a);
      a++;
    return toRet;
function multiSelectByIDX(idx) {// selection function
  if( idx.constructor != Array ) idx = [ idx ];
    var layers = new Array();
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    for (var i = 0; i < idx.length; i++) {
          layers[i] = charIDToTypeID( "Lyr " );
          ref.putIndex(layers[i], idx[i]);
    desc.putReference( charIDToTypeID( "null" ), ref );
    executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
function selectAllByColor(TheColor){// main function
  theSameClIDX = getIDXwithsameColor(TheColor);
  multiSelectByIDX(theSameClIDX);
//...example::
// selectAllByColor("none");
//selectAllByColor("red");
// selectAllByColor("orange");
// selectAllByColor("yellowColor");
// selectAllByColor("grain");
// selectAllByColor("blue");
// selectAllByColor("violet");
// selectAllByColor("gray");

Similar Messages

  • CS5.1 overrides CS5 registry entries, how do I get the photoshop installation location safely?

    Hi there,
    I'm creating a installer for my Photoshop plugins, so I need to find out Photoshop installation directory. I did this by looking for registry 'HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Photoshop\', but I found that CS5.1 will override the CS5 registry entries - they are both in ’HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Photoshop\12.0‘
    So how can I distinguish CS5 and CS5.1 in the registry? Or how can I get the correct installation direcotry for both CS5.1 and CS5?
    Thanks,
    Daniel

    You can't on Windows. On Mac they did the right thing and made a seperate .paths files. On Windows they just tromped on the CS5 registry entries with the CS5.1 entries, even though it's a completely seperate application installation with its own plugin path. Not too cool.
    Although, it only matters if you encounter the probably rare corner case where a user has both CS5 and CS5.1 installed AND wants to put the plugins into the CS5 plugin path. We just punted and can only install into CS5.1 in that case, unless the user manually selects the installation location. It hasn't generated any significant support issues for us that I know of.

  • How can i get the h:selectOneRadio value with javascript

    Hi all.
    I have this code
    <h:selectOneRadio id="color" style="font-family: Arial;font-weight:lighter;font-size: 12px" onclick="showColor()" >
    <f:selectItem itemLabel="RED" itemValue="1" />
    <f:selectItem itemLabel="BLUE" itemValue="2" />
    </h:selectOneRadio>
    And javascript function is
    function showColor()
    var tipoRelacion = document.getElementById("form:color").value;
    alert("color" + tipoRelacion);
    And what i get is that color is undefined. How can i get the value of the selected radio?
    Thanks a lot

    you just need to pass this while calling javascript function
    check this-
    <h:selectOneRadio id="color" style="font-family: Arial;font-weight:lighter;font-size: 12px" onclick="showColor(this)" >
    <f:selectItem itemLabel="RED" itemValue="1" />
    <f:selectItem itemLabel="BLUE" itemValue="2" />
    </h:selectOneRadio>
    And javascript function is
    function showColor(obj)
    var val = obj.value
    alert("color" +val);
    }

  • PhotoShop CC did not download, Adobe claims it did.  How do I get the Photoshop CC I paid for?

    PhotoShop CC did not download to my mac.  Adobe thinks it did.  How do I set them straight?

    Hi,
    Please follow the below link and uninstall Photoshop as it seems like there are some traces of Photoshop on your MAC.
    http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html
    Regards,
    Prabs

  • How can i get the item of combobox in javascript LCD?

    Hi!
    I have a question about javascript in LCD i want to get or assign the item value of a combobox because i need to mapping and i´ve tried using the option
    form1.Page.Contenedor.RadioBtn.rbTipo[1].caption = "nuevotexto";
    form1.Page.Contenedor.RadioBtn.rbTipo[1].rawValue = "nuevotexto";
    and more... but i don´t know if that is possible, could someone help me?
    thank's

    Hi,
    I think you are trying to set the value of a radio button group(???).
    If so, then you first need to look in  the Object > Binding palette to set the bound values.
    Then you can set the value of the radio buttons by referencing the exclusion group and not an individual radio button.
    If you have three radio buttons in an exclusion group 'RadioBtn' and they had bound values of '1', '2' and '3'. Then the following script would select the second button in the group:
    form1.Page.Contenedor.RadioBtn.rawValue = "2";
    If I have picked up your query wrong, then come back with some more info.
    Niall

  • How to get the name of tag or variable

    Hi everyone,
    I am a newbie, I have problem on getting the name or tag of the variable from OLE for Processing Control(OPC) server, could anyone tell me how I can get the name of tag or variable from writting vb codes or please direct me to any helpful information. Here are
    my codes,
    Dim ItemsDef(NBR_ITEMS) As String
    Dim DeviceAddress As String
    Dim IndItem As Long
    DeviceAddress = "MBT:152.160.178.60"
    'Preparing the Handles for "AddItems"
    For IndItem = 1 To NBR_ITEMS
    ItemsDef(IndItem) = DeviceAddress & "!40000" & Format(IndItem) '40000 is the memory location of variable in the OPC, how can I get the variable name, what is the code or syntax?
    Next
    blah...
    Thank you,
    Calvin

    Hi Calvin,
    If you are looking for general information and examples about OPC, then we have lots of places for you to browse!
    Here is a small list, and you can probably find other links within these documents:
    **If you have Measurement Studio from National Instruments, then you can look at the "Measurement Studio Reference" help file. Search for OPC and in the overview you will find the methods for accessing the items on an OPC server.
    **Elsewhere in the help file, you can find a link to this Application Note on our developer zone
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?​openagent&F4921B34CA8F4A9786256874005BE3F7&cat=7CD​A3E51FEFC4AA2862568B80071A1E2
    **One more resource is http://www.ni.com/opc
    **Probably the most useful will be the examples yo
    u can find on our web site. You can go to http://www.ni.com/support and in Option 3 search the Example Code database for "opc".
    In the first example program (Controlling OPC Servers with the OPC Automation API in Visual Basic) that you should get when searching for "opc" in the example programs database, look for the line with this code: "browser.GetItemID(leaf)". There you can see the way the program creates an OPCBrowser from the server instance, and then gets the servers available items for use by the client. This sounds like the specific information you are looking for with the variable name.
    If you aren't able to find out your answer here or in the various help resources, then please feel free to contact us at National Instruments at http://www.ni.com/ask
    Regards,
    John N
    Applications Engineer
    National Instruments

  • Trial download for photoshop crashed and won't let me download. how can i get the free trial?

    trial download for photoshop crashed and won't let me download. how can i get the free trial?

    What means "crashed", and "won't let me"?
    Anyway, download it from http://www.adobe.com/downloads.html
    Usually I would recommend to download the direct downloads from http://prodesigntools.com/tag/ddl, but it seems the site is currently down.

  • How do I get the pictures folders in photoshop 7 out of My window XP computer and put them into my new computer windows 8 photoshop12

    How do I get the pictures folders in photoshop 7 out of My window XP computer and put them into my new computer windows 8 photoshop12

    I am so sorry for you and your situation. Were you using iCloud photostream?
    Otherwise I do not see any chance for your precious photos.
    Congrats anyway on the little darling!

  • My Photoshop Elements does not start any more. It gives response "Photoshop elements cannot start or continue because of missing file(s). Please reinstall." How do I get the installing file again (I bought it via internet the first time december 2013?)

    My Photoshop Elements does not start any more. It gives response "Photoshop elements cannot start or continue because of missing file(s). Please reinstall." How do I get the installing file again (I bought it from Adobe via internet the first time december 2013?)

    Did you download the Basic/Free version?
    I also thought the Trial period was as long as you needed!?
    What is your Warranty and Return Policy?
    You get to use VueScan for as long as you want before you buy it, so we recommend you test it before you buy it to make sure it meets your needs.
    All sales are final and there are no refunds.
    Isn't this a bit harsh? Naah I actually prefer to solve problems, and if I offer refunds, people give up too easily. If I can't solve your problem after you send a few Problem Reports (see above), I'm happy to give a refund.
    http://www.hamrick.com/sup.html#q

  • When editing an image in Photoshop from Lightroom then saving it back to Lightroom, how do i get the image to go back and  sit next to the original? Mine is going to the end of the folder. Thanks Karen

    When editing an image in Photoshop from Lightroom then saving it back to Lightroom, how do i get the image to go back and sit next to the original image? Mine is going back to the end of the folder. Thanks Karen

    Hi Karen
    You may the sort set to Custom. Click the dropdown menu on the toolbar (to the right of the word sort) and change to capture time.
    If you can’t see the toolbar above the filmstrip press the T key. Press T again to hide.

  • I am downloading from a Canon 650D to Photoshop CS5.1 AND Adobe Bridge CS5.1  do i need to download a  DNG convertor? if so how do i get the images from the camera to the convertor?

    I am downloading from a Canon 650d  TO Photoshop CS5.1  and Adobe Bridge CS5.1  Do i need to download a DNG convertor? if so how do i get the images from the camera to the convertor?

    Please check the list yourself and co,mare the necessary CR version with the one your version of Photoshop utilizes. 
    If the version os higher than yours you can use the free DNG Converter – as to how to use it please read up on that.
    Camera Raw plug-in | Supported cameras

  • How can I get the picture to show in Photoshop?  The thumbnail image appears in the right side panel but the full image isn't showing at all.

    How can I get the picture to show in Photoshop CS3?  The thumbnail image appears in the right side panel but the full image isn't showing at all.

    What specific information would you need?  The program was working just fine early yesterday morning and than when I came back in the afternoon to edit  some more pictures that is when I wasn't able to see the full image anymore.  It is providing me with all of the editing options as if the picture is there but it is just a blank screen with the thumbnail pic showing in the right panel. 

  • After purchasing the Photoshop cs6 update for my Mac, the download page says for "Windows". Will this still work? How do I get the right download without purchasing again

    After purchasing the Photoshop cs6 update for my Mac, the download page says for "Windows". Will this still work? How do I get the right download without purchasing again?

    no.
    you need the update for a mac, not windows.
    Product updates

  • When I move a RAW file from IPhoto to my desktop or Photoshop it changes to a jpeg and reduces in size. How can I get the Raw file across?

    When I move a RAW file from IPhoto on my macbook pro to desktop or Photoshop it changes to a jpeg and reduces in size. How can I get the Raw file to move across?

    I create separate folders based on the year and then the actual date of when I take images. You can make those folders anywhere on any hard drive that is connected to your Mac whether internal or external. I also use the Photoshop Photo Downloader that is included with Photoshop/Bridge and it will create the date folder so all I do is create a Year folder.
    Open Bridge or click on the Bridge icon in PS and in the File menu item in Bridge select "Get photos from Camera". It can be a camera connected to your Mac or a memory card from a camera. A window will open and you then select the camera or memory card. Set the location they will be downloaded to, just the folder and you can Browse to a folder that you created, then in the "Create  Subfolders drop down select what date stamp you want to use or or custom name or not to create subfolders at all.
    I've never cared for iPhoto one bit. I tried it but found it way to restrictive. It likes to have full control over how you interact with your images.

  • How do I get the training videos to work for photoshop elements 11

    How do I get the training videos to run so that I may learn how to use photoshop elements 11?

    Just go to tv.adobe.com and you can watch them there. It's much simpler than trying to hassle around with the problems with installing AIR and so on.

Maybe you are looking for

  • Changing the color of a registered trademark symbol in a logo and what is the the symbol's size?

    I have a logo with the registered trademark symbol.  I tried to change the color of the registered trademark symbol to the same color as the logo, using the color replacement tool but it did not work.  Is there another way to change its color? Also,

  • Auto Incrementing a field in a database table

    Hello All, I have created a database table for generating a unique ID, based on two key fields; Product and Area. For a particular Product and Area,the ID generated should be unique, and it will be the third field of my table. Is there any possible w

  • Insert or Replace from Clipboard?

    Is there a way to insert or replace a VI from the clipboard?  Or maybe a quick drop plugin to do this? Is it possible to do with a quick drop plugin? I ran into a situation earlier where I needed to insert a simple VI to a number of wires in differen

  • Freeze during iWork 09 installation

    The installer froze during the installation of iWork 09 trail. I downloded from Apple.com and opened the dmg file. The installation froze at the stage "Configuring Installation". I waited for about 1 day and I finally gave up. Is there something wron

  • Missing wire connectors on DAQ Assistant express VI's

    I'm seeing some strange behavior on one specific computer running LabVIEW. The problem is that DAQ Assistant VI's have no connector points. I have nine other identical computers (used in a classroom setting) but I don't see this behavior on the other