Test whether a layer with a specific name exists?

Is there a simple way to test whether a layer with a specific name exists?

Simon Dav wrote:
- Multiple layer names
- working only for one layer name
- can you help me for this, how to get multiple names.
- layers "Background", "Artwork", "diecut", "size", "sign of panel"
This should work, as one possible approach:
var doc = app.activeDocument
var layersToTargetNameArray = ["Background", "Artwork", "diecut", "size", "sign of panel"];
for (var i = 0, il = doc.layers.length; i < il; i++) {
    var curLayer = doc.layers[i];
    for (var j = 0, jl = layersToTargetNameArray.length; j < jl; j++) {
        if (curLayer.name == layersToTargetNameArray[j]) {
            // do something if layer name found
            curLayer.visible = false; // basic example
        } else {
            // do something else if layer name not found
Hope it helps your efforts.
Please Note: If your question exceeds this working response with further unrelated requirements (non related to this thread) you should start a new thread instead for your question, as proper etiquette.

Similar Messages

  • Search if a layersets with a specific name exist and execute a function if it is the case

    Hello,
    How can i write a script that search if a layersets with a specific name exist and execute a function if it is the case?
    Some examples?
    Many thanks.
    Regards.
    Sebastien

    This would check for a LayerSet if a name with DOM code – so it’s fairly slow.
    var check = checkForLayersetNamed(app.activeDocument, false, "thisName");
    alert (check);
    ////// function collect all layers //////
    function checkForLayersetNamed (theParent, theCheck, theName) {
    /* if (!allLayers) {var allLayers = new Array}
      else {};*/
      for (var m = theParent.layers.length - 1; m >= 0;m--) {
      var theLayer = theParent.layers[m];
    // apply the function to layersets;
      if (theLayer.typename == "ArtLayer") {
    // allLayers.push(theLayer)
      else {
      if (theLayer.name == theName) {theCheck = true};
      theCheck = (checkForLayersetNamed(theLayer, theCheck, theName))
    // allLayers.push(theLayer);
      return theCheck
    Below is AM code Paul Riggott posted some time ago in connection with linking Layer Masks.
    Re: Automatically re-link layer masks
    You could add a check for whether the Layer is a LayerSet, but if the name is the sole distinguishing feature this might work as a basis for your operations.
    app.bringToFront();
    main();
    function main(){
    if(!documents.length) return;
    linkLayers();
    function linkLayers(){
       var ref = new ActionReference();
       ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
       var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL')) +1;
       var Names=[];
    try{
        activeDocument.backgroundLayer;
    var i = 0; }catch(e){ var i = 1; };
       for(i;i<count;i++){
           if(i == 0) continue;
            ref = new ActionReference();
            ref.putIndex( charIDToTypeID( 'Lyr ' ), i );
            var desc = executeActionGet(ref);
            var layerName = desc.getString(charIDToTypeID( 'Nm  ' ));
            var Id = desc.getInteger(stringIDToTypeID( 'layerID' ));
            if(layerName.match(/^<\/Layer group/) ) continue;
    /* you could insert your operations in an if clause here */

  • Adding a sheet in excel with a specific name.

    How can I add a sheet in excel with a specific name after an existing sheet with an unknown name.

    Just use the Sheets->Add function and wire the existing sheet index into the After input.
    From the Workbook refnum:
    Wire Property Node - Workbook->Sheets
    Wire Method Node - Sheets->Add, wire the After input
    Convert the Variant from Add into a WorkSheet type
    Wire Property Node - WorkSheet Name
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector
    Attachments:
    Add_Sheet.gif ‏4 KB

  • How to name a layer with the file name - action or script???

    Hi all,
    Can anyone tell me if it is possible to automatically name a photoshop layer to be the name of the file itself?
    I have 600 files to do and need to automate the process.
    Thanks in advance for any advice.
    Marvo.

    Open ExtendScript Toolkit this can be found here:-
    PC: C:\Program Files\Adobe\Adobe Utilities
    MAC: <hard drive>/Applications/Utilities/Adobe Utilities
    Copy and paste the code into a new window and then save the code to:-
    PC: C:\Program Files\Adobe\Adobe Photoshop CS#\Presets\Scripts
    Mac:- [hard drive]/Applications/Adobe Photoshop CS#/Presets/Scripts/
    If photoshop was open, close and re-start it so that Photoshop can pick up the new script.
    Now you can create an action to run the script and do your save so that this action can be batched.
    To add the script to your action:
    File - Scripts - select the script (this will add the new layer)

  • How to make applescript open a new safari window with a specific name?

    tell application "Safari"
      activate
      make new document at end of every document with properties {name:"MY-NAME", URL:"http://www.google.com"}
    end tell
    Run this script and see if you can figure out why the NAME of the window is still "Google".
    The dictionary  shows several different NAMEs for windows, documents and tabs and only tabs are R/O.
    This doesn't do anything either:
    tell application "Safari"
      activate
      make new document at end of every document with properties {name:"MY-NAME", URL:"http://www.google.com"}
      set the name of window 1 to "TEST"
    end tell

    The title of the window is provided by the page source.
    You can override it (once loaded) with, e.g,
         do javascript "document.title='MY-NAME'" in document 1
    If you had a blank Safari page (i.e. not Top Sites which does contain source data), you should be able to change the window title with
         set name of document 1 to "MY-NAME"

  • I need to be able to save pictures with a specific name and email as a .jpg file (not an jpeg image).  Any app suggestions to be able to do this?

    I purchased Photoshop Touch which let me save the picture with a name, but when I emailed it, is was an jpeg image. 
    Anyone know how I can do this or have suggestions for other apps.   I've done quite a bit of research and having trouble finding this specific type of information
    Thanks!!

    Hi, I had the same issue. My solution was to take the freeware-tool clickto.
    So I'm now able to take any text, copy it and past it via clickto into a new mail.
    [http://www.clicktoapp.com Clickto ]expands your copy-paste feature by showing you some "satellites" after doing the copy action. These "satellites" now will give you some opportunities to paste your copied content, for example a picture to facebook or a text to a new mail on gmail with just 1 single click.

  • Automatically exclude all folders with a specific  name?

    I am using Apple's Logic audio program (but this could apply to anything):
    Every Logic project creates a folder named Freeze Files which is usually very large
    and not necessary (for me) to back up. So I'd like to tell TM to hide every instance of any folder named "Freeze Files", rather than hiding each one individually.
    Possible?
    Thanks.

    atom wrote:
    I am using Apple's Logic audio program (but this could apply to anything):
    Every Logic project creates a folder named Freeze Files which is usually very large
    and not necessary (for me) to back up. So I'd like to tell TM to hide every instance of any folder named "Freeze Files", rather than hiding each one individually.
    Possible?
    there is certainly nothing built in that's even remotely capable of this. it might be possible to script something but it could be pretty tricky. unless you are fairly familiar with shell and/or apple scripting you should probably forget it. Also, it's not clear exactly what you want. do you want this to be a one time operation or do you want it to automatically apply to all future "Freeze Files" folders?
    Thanks.

  • Question on multiple form elements with the same name !

    Hi All,
    I have a requirement in which more than one text field with the same name exists on a HTML page. We are using JSF framework (Oracle JDeveloper IDE and OC4J ) . I tried using a String array in my backing bean to handle these text boxes. When I hit the Submit, the action (method) is not invoked. But when I try with unique names everything works fine. Am I going wrong somewhere ?
    Thanks in Advance.

    You cannot have exactly the same name on objects.
    You will have to make an array of them to be able to
    o work with them properly--it will keep the names
    unique.I understand! But JSF creates its own names which are unique. The following JSF code
            <htm:tr>
                <htm:td>
                    <h:inputText value="#{Test.description}" id="description1"/>
                </htm:td>
            </htm:tr>
            <htm:tr>
                <htm:td>
                    <h:inputText value="#{Test.description}"  id="description2"/>
                </htm:td>
        </htm:tr>generates the following HTML code with unique names.
            <tr>
                <td>
                    <input id="Test:description1" type="text" name="Test:description1" />
                </td>
            </tr>
            <tr>
                <td>
                    <input id="Test:description2" type="text" name="Test:description2" />
                </td>
        </tr>
        <tr>Though I have a String Array in the backing bean, this doesn't work (The form does not submit to the method in the Backing Bean).
    Similar situation in Struts works absolutely fine.
    Any help would be appreciated !!!

  • Cloning OS2 HDD to USB stick hangs at a file with the same name ???

    Hi,
    I'm dragging my MacIntosh HD icon to a large USB stick in order to clone it because I'm going to install OS X Tiger onty my iMac G3/400 DV SE. The copying initiates, it starts, and after a few hundreds of MB's a small window pops up with this remark (translated from Dutch) :
    " The file XXXXX cannot be copied because another file with the same name exists already." The window has two buttons : STOP and Continue. No matter which button I click, the process stops and I'm left with a few hundred MB on my USB stick. Deleting the "double" file doesn't help because a few minutes later another one pops up.
    How is this possible? The USB stick is completely empty! Can anybody tell me what's going on and how to stop this, otherwise I'll never be able to clone the HDD.
    Thanks for your kind information,
    Paul

    It was a bug in Classic OS, which was manifest in certain circumstances. My workaround was, at that time, to isolate the rascal (was possible, like in your case), eliminate it, then add it later.
    Such events may occurs with Mac OS X files too, I cannot figure out why. One or two apps in my software archive usually do that.
    another workaround it to archive it (.zip now, .sit in classic Mac OS), check whether applicable.

  • Upload new pdf file with the same name

    We are trying to upload a pdf file with a specific name (i.e
    file.pdf) that has links to it on many pages of a website. We need
    the pdf file to keep the same name but when we try to upload it,
    Contribute is being 'smart' and changing the name so as to not
    overwrite the file on the server. But we WANT to overwrite the file
    on the server. Any ideas on how we can achieve this in Contribute?
    Thanks so much (in advance) for your help!

    Actually, we have the same problem and I believe the answer
    lies in the abilities that your role has assigned to it. The
    solution that ThinkInk gave works *if you are allowed to delete
    files*. If your role doesn't have that permission, then it will
    just upload another copy of the file and rename it.
    It's rather irritating that there isn't more control over
    this...our server is littered with *thousands and thousands* of
    duplicate files that originate from this situation.
    If your administrator wants you to be able to delete files as
    well, then you could get him/her to give you that permission, and I
    believe this will allow you to overwrite the file by using the
    "Publish file from my computer" option described above.

  • WEBI - how to save a report with a dynamic name

    I would like to create a report (pdf) and save it with a specific name :
         Example :      « Report_Name_YEAR_MONTH.pdf »
                   « Report_Name_object.pdf » where object came from the report WEBI.
    BO Xi propose the %SI_STARTTIME% variable on "date + time" format.
    1 - Can I use an other variable in order to have a date with this format : Year + Month ?
    2- Can I use an object create on the report WEBI ?

    Hello,
      I tried to save the variant of DEMO_PROGRAM_GET with dynamic selection field (Connection Number) filled. It gets saved without any problem. Just click 'SAVE' and enter the variant name and description.
    Thanks,
    Venu

  • How do you force instances with the same name on the same layer to update?

    Maybe someone can tell me why flash doesn’t redraw
    components’ x,y positions if they have the same instance name
    and are on adjacent frames? (movieclips work fine, just not
    components) If I have a button on frame 1 and a button on frame 2
    both with the same instance name but different locations on the
    stage, frame 2’s button doesn’t show up in the position
    I placed it, it stays at the position of frame 1 but still has the
    properties of frame 2’s button. The label changes and
    everything. If I stick a button on a frame in between and give it a
    different instance name there is no problem. I thought it might be
    the style manager bug
    http://www.gskinner.com/blog/archives/2007/12/cs3_component_b.html
    but it didn’t seem to affect. This happens for textareas too
    and probably all components although I haven’t tried them.
    I’ve tried using drawNow() and validateNow() with no luck
    either
    http://www.adobe.com/devnet/flash/articles/creating_as3_components_pt3_05.html
    Thank you!
    // put this on frame 1 along with a button on the stage with
    instance name: b
    function doit(event) {
    if (currentFrame == 1)
    gotoAndStop(2);
    else
    gotoAndStop(1);
    b.addEventListener(MouseEvent.CLICK, doit);
    stop();
    // put another button on frame 2 along with this code and
    also make it’s instance name: b but move it so it’s not
    in the same x,y coordinates as the button on frame 1
    stop();
    Something possibly related. I have a movieclip on a layer,
    one instance with name “a” on frame 1 and one instance
    with name “a” on frame 2 and it has event listeners
    inside it that update something on the movieclip. Unless I put the
    movieclips on separate layers the event listeners won’t reset
    each frame. (example: a button with a tooltip onmouseover that you
    want to change the text of from frame 1 to frame 2) You’d
    think if they were on separate keyframes at least but no, they need
    to be on separate layers too.
    I want the movieclip to update each frame. Any ideas?

    instances (whether components or not) with the same name may
    or may not be the same instance. it depends upon how they were
    created.
    for example, if you create an instance on frame 1 of your
    main timeline, give it an instance name and then create a keyframe
    on frame 2, the two instances will be the same.
    but if you create an instance on frame 1 of your main
    timeline, give it an instance name and then create a blank keyframe
    on frame2 and create another, what you think is a duplicate,
    instance and give it the same name, it will be a different
    instance.

  • How to test whether AIA got integrated with BRM system successfully

    Is there a procedure to test whether AIA got integrated with BRM system successfully.How can i test whether BRM Adapter is able to connect to BRM system.
    Thanks well in advance
    Santosh

    Hi Santhosh,
    I hope you are using AIA 2.0/2.0.1 for Comms and trying to integrate BRM with Siebel.
    1. To check BRM & Siebel integration using AIA. (BRM is the Product master gets synched with Siebel.)
    a) Create a new Product in BRM pricing center(Provide product name, Service type)
    b) Select Event(Single time purchase event)
    c) Provide rating for the product
    d) Commit after product creation(Check in BPEL process, whether all the instances are went through successfully)
    e) Check Siebel Catalog, whether product got synched from BRM
    2. To check whether BRM Adapter connected to BRM,
    a) Login into Oracle Application server
    b) Select OC4J instance, where your AIA is running
    c) Select Applications
    d) In view drop down select "StandAlone Resource Adapters"
    e) Check the status (green or red) in the installed BRM adapter
    If you haven't deployed BRM Adapter read the installation guide to deploy it.
    Regards,
    Ziaur Rahuman

  • [svn] 889: Add test case for BLZ-82 where HttpService should return multiple headers with the same name .

    Revision: 889
    Author: [email protected]
    Date: 2008-03-21 13:08:05 -0700 (Fri, 21 Mar 2008)
    Log Message:
    Add test case for BLZ-82 where HttpService should return multiple headers with the same name.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-82
    Added Paths:
    blazeds/trunk/qa/apps/qa-regress/remote/MultipleHeadersTest.jsp
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/proxyService/httpservice/MultiHe aderTest.mxml

    Hi again,
    this may be old news to some people, but I just realized we can have the desired benefits I originally listed (encapsulation, reuse, maintainability, security) TODAY by using pipelined functions and using the table() function in Apex report region queries.
    So the report query basically becomes, for example (if get_employees is a pipelined function)
    select * from table(my_package.get_employees(:p1_deptno))
    The only downside compared to a (weakly typed) sys_refcursor is that you have to define the type you are returning in your package spec (or as an SQL type). So it's a bit more coding, but it's still worth it for the other benefits it provides.
    I like Apex even better now! :-)
    - Morten

  • Sap adobeform sending pdf as attachment with specific name

    Hi Experts,
    Need your help in solving my problem !!
    My requirement is to send adobe form as mail attachment in PDF format, Which I am able to do.
    My Problem is PDF attachment should be generated with specific name.
    For example my scenario (below given screen shot),
    When i click on submit by email button, PDF will be attached to my mail,
    with some random name such as "d4811f8_45171.pdf" Instead it should be generated with
    fixed name such as "new_attach.pdf" or dynamic name using user name such as
    "Vishwa_attachment.pdf".
    Kindly help to achieve my needs.
    Any help will be greatly appreciated and rewarded.
    Thanks in advance,
    Regards,
    Vishwa

    Hi Naveen,
    please read through my query again, I should generate pdf when I click on "submit by email button".
    I am not using any function for conversion it will happen automatically.
    thanks,
    Vishwa

Maybe you are looking for

  • Old DOS Game file locked in Trash & on Desktop, can't remove

    I recently used an old flash drive that had a ancient DOS game of Mahjong on it. I moved the game to trash and when emptying the Trash, four Tile (.Tis) files from the Mahjong game somehow got locked and, apparently, can't be removed. I dragged one o

  • A/V input?

    Hello I have a super nintendo with A/V cables and I have no TV in my room I was wondering if there was any A/V input adapter for me to use it with my iMac??? Just to make it easier on me.

  • PS CC will no longer open

    It has worked fine for 2 months. Now it won't open from the Desktop, from the Program files (x86) Application icon, from Lightroom or Bridge. Using Windows 8

  • Dreadful export time

    Hi, I'm exporting a reference movie for a producer to screen, and a native 5 minute HD clip (not changing any export settings) is taking 15 minutes or so. I've tried several combinations of movies, smaller size, least quality, etc, and these take lon

  • Transport of Factory Calendar

    Hi BI Gurus, I have created a new factory calendar in BI Development system and transported to Quality system successfully. When i proceed to transport to Production system, it return RC = 0 but I couldn't find the newly created Factory Calendar in B