Select layer by name.

I need to be able to select a specific layer by name to make active. I cannot find any documentation.
The layer name is always "PDF (Replace Contents...)" - then I'll replace the content with a specified  PDF (constant - naming convention also).
-kp

Search on getbyname in the scripting guides you will find documentation like this
The collections, as in this example, can be treated as arrays, which is useful for iteration. They also provide
methods to create their contained objects, and to access them by name:
var newLayer = activeDocument.artLayers.add(); // Create a new ArtLayer object
newLayer.name = "My Layer"; // name it for later reference
var layerRef = activeDocument.artLayers.getByName("My Layer");
so you would code somethinf like this
try { var layerRef = activeDocument.artLayers.getByName("PDF");}
catch(e){
                    alert("Document does not have the Required PDF layer");
                    var abort = true

Similar Messages

  • I need to create an action or script to save the file with the name of the selected layer

    I need to create an action or script to save the file with the name of the selected layer (not including the hidden layers, but including those visible).
    How could modify the script: 'Layer Comps To Files.jsx' to get the result?
    Warning: I do not need to export all layers as files.
    Who can help me?
    THX in advance

    Versione in Italiano (Further down the English version)
    NB - Nella versione inglese ho messo tutte le immagini dei menu in italiano.
    Versione per Mac, ma credo sia identico per Windows.
    Spiego passo passo cosa ho fatto:
    - Ho creato un file esempio con tre Livelli, salvato sulla scrivania e ho chiuso il file.
    - Ho aperto il file e selezionato il Livello al centro per iniziare a registrare una azione che ho chiamato: Save with Name of Selected Layer
    - Nuova azione
    - Dare il nome e premere Registra
    Ora salva…
    - Menu --> Livello --> Nuovo --> Livello... e premi -ok-, (lascia il nome che viene mostrato)
    - Ancora una volta Menu --> Livello... --> Nuovo --> Livello... e premi -ok-, (lascia il nome che viene mostrato)
    - Menu --> Livello --> Ordina --> Dietro
    - Menu --> Livello --> Unisci sotto
    - Menu --> Livello --> Unisci visibili
    - Menu --> Livello --> Nuovo --> Livello... e premi -ok-, (lascia il nome che viene mostrato)
    - Menu --> Livello - Nascondi Livello
    - Menu --> Elimina --> Elimina livelli nascosti (press -Yes-)
    - Menu --> Livello --> Nuovo --> Livello... Inserisci questo: 'Move this to the trash' e premi ok
    - Menu --> File --> Script --> Esporta Livelli in File... (Nella finestra che si apre scegliere l’opzione che si desidera, ma togliere il prefisso del nome) e premere -Esegui-
    - Selezionare il pannello Storia cliccare su Elimina premendo -Si- ogni volta che si apre la finestra di dialogo (Ripetere 8 volte questa operazione sino ad arrivare nella storia alla condizione di partenza. Ho visto che è meglio di Ripristina -F12-)
    - Fermare la registrazione.
    A questo punto, mandando in esecuzione questa Azione, ho raggiunto parzialmente l’obiettivo perché i file così creati mantengono, purtroppo, dei prefissi numerici per evitare probabilmente la sovrascrizione di file (credo senza avviso) nel posto dove vengono creati.
    Per ottenere l’obiettivo occorre un nuovo passo ed a proposito di questo riferisco quanto segue:
    ATTENZIONE - L’operazione descritta qui di seguito deve essere fatta su di una copia del file, per cui:
    - Duplicare il file,
    - Spostare l’originale in altra cartella
    - Lavorare sul file duplicato.
    mi riferisco a questo...
    ATTENZIONE - Questa modifica è effettuata a proprio rischio e pericolo ed il sottoscritto non si assume alcuna responsabilità su quanto venga fatto soprattutto da mani inesperte.
    ATTENZIONE - Questa modifica sovrascrive qualsiasi file che abbia nome uguale al layer che viene selezionato più l’estensione del file naturalmente.
    Comunque la modifica è banalissima e a portata di chiunque.
    Procedere così:
    - Chiudere Photoshop
    - Aprire (nel percorso specificato dall’immagine) il file “Export Layers to Files.jsx” (Export Layers To Files.jsx 1.0.0.16) con un editor di testo puro.
    - cercare la stringa (dovrebbe essere in riga 1029)
    var fileNameBody = fileNamePrefix;
    fileNameBody += "_" + zeroSuppress(i, 4);
    fileNameBody += "_" + layerName;
    - sostituirla con:
    var fileNameBody = fileNamePrefix;
    fileNameBody += layerName;
    - cercare la stringa (dovrebbe essere in riga 1047-46)
    var fileNameBody = fileNamePrefix;
    fileNameBody += "_" + zeroSuppress(i, 4) + "s";
    - sostituirla con:
    var fileNameBody = fileNamePrefix;
    fileNameBody += "";
    - salvare e uscire.
    - riavviare Photoshop
    - provare l’azione registrata facendo attenzione che il nome del layer non sia identico al nome di un file già presente altrimenti questo verrà sovrascritto.
    Domanda:
    Perché ho creato livelli che poi ho eliminato ecc.
    Risposta:
    Semplice per evitare errori di esecuzione delle azioni nel caso di operazioni con livelli mancanti o altro.
    Semplice... no?
    English version
    Mac version, but I think it's the same for Windows.
    First of all, I'm translating the actions that I made using the Italian version of Photoshop, you look at the position of the menu that I have chosen to do the work with other languages.
    I explain step by step what I did:
    - I created a sample file with three layers, saved to the desktop and I closed the file.
    - I opened the file and select the layer at the center to start recording an action that I called: Save with Name of the Selected Layer
    - New action
    - Give the name and press Save ( I think it is so in English )
    Now save ...
    - Menu -> Layer - > New —> Layer… and press -ok- , (leave the name that is shown)
    - Once again Menu -> Layer - > New —> Layer… and press -ok- , (leave the name that is shown)
    - Menu -> Layer - > Arrange (order) -> Behind
    - Menu -> Layer - > Merge Down
    - Menu -> Layer - > Merge Visible
    - Menu -> Layer - > New —> Layer… and press -ok- , (leave the name that is shown)
    - Menu -> Layer - Hide Layer
    - Menu - > Delete - > Delete hidden layers (press -Yes- )
    - Menu -> Layer - > New —> Layer… Enter this: ' Move this to the trash ' and press ok
    - Menu -> File - > Scripts -> Export Layers To Files... (In the window that opens select the option you want, but take away the name prefix) and press - Run -
    - Select the History panel and click Delete (on menu opened) pressing -Yes- every time when open the dialog box (8 times Repeat this step until you get into the story to the starting condition. Not use Restore -F12-).
    - Stop recording.
    At this point, by executing this action, I have reached the goal partly because the files created in this way remain, unfortunately, the numerical prefixes to avoid possibly overwriting of files (I think without notice) in the place where they are created.
    To achieve the goal we need a new step and thinking about this as follows:
    WARNING - The operation described below should be made on a copy of the file, so :
    - Duplicate the file
    - Move the original folder to another
    - Work on the duplicate file.
    WARNING - This modification is performed at your own risk and the undersigned assumes no responsibility on what is done mostly by inexperienced hands.
    WARNING - This change will overwrite any files with the same name as the selected layer plus the file extension of course.
    However, the change is trivial and within reach of anyone.
    Proceed as follows:
    - Close Photoshop
    - Open (in the specified path from the image ) file " Export Layers to Files.jsx " (Export Layers To Files.jsx 1.0.0.16) with a pure text editor.
    - Search for the string (should be in line 1029 )
    var = fileNameBody fileNamePrefix ;
    fileNameBody = + "_" + zeroSuppress (i, 4 ) ;
    fileNameBody + = "_ " + layerName ;
    - Replace it with :
    var = fileNameBody fileNamePrefix ;
    fileNameBody + = layerName ;
    - Search for the string (should be in line 1047-46 )
    var = fileNameBody fileNamePrefix ;
    fileNameBody + = "_ " + zeroSuppress (i, 4) + "s" ;
    - Replace it with :
    var = fileNameBody fileNamePrefix ;
    fileNameBody + = "";
    - Save and exit.
    - Restart Photoshop
    - Try the recorded Action, making sure that the layer name is not identical to the name of an existing file otherwise it will be overwritten.
    Question:
    Why I created levels which I then deleted etc..
    Answer:
    Simple to avoid errors of execution of the actions in the case of transactions with missing levels and other.
    Simple ... is not it?
    Sorry for my bad English...
    Thanks in advance for any hint.
    --->>> Please think about this... Adobe <<<---

  • Run action to find layer by name and select it...

    I have a folder of 10,000+ files that I need to run a simple action on. I'd like to open a file, have it find the topmost layer names "RED," select it, rasterize it, and then save/close. I've been able to figure out every step except selecting the layer I need. I've tried the "insert menu item" command in the actions drop down menu, but it only gives me options for things like "select all layers" or "select similar layers." The "Insert select path" only lets me select 10 paths at a time, and won't select compound paths. What I need is to be able to select a layer named "RED" as part of the action. Photoshop allows you to do that, so I was hoping Illustrator might afford me the same convenience. Any ideas?
    Vinny

    The following is an AppleScript. Open the ScriptEditor in the applescript folder and paste into a new window. Run it on a sample folder and we'll see how it does.
    --get a sourceFolder that holds the files to print
    set sourceFolder to (choose folder with prompt "Choose a folder with files to process:") as text
    -- get a list of files of the files to be printed in the sourceFolder
    tell application "Finder" to set workingFiles to (every file of folder sourceFolder) as alias list
    repeat with workingFile in workingFiles
        tell application "Adobe Illustrator"
            open workingFile
            tell current document
                set layerRef to (first layer whose name is "RED")
                set g to every page item of layerRef
                repeat with i from 1 to count of g
                    set selected of item i of g to true
                    do script "raster" from "Default Actions" without dialogs
                    delay 1
                end repeat
            end tell
            close current document with saving
        end tell
    end repeat
    Don't include the underlines.
    The do script line refers to an action you create in your default actions with just one thing. It's case sensitive.
    Let me know if you need more help

  • How to create an action to save the file as the name of the selected layer

    I have a .psd with several layers, and I would like to save multiple versions of the document based on the layer name. Is there a way to tell Photoshop to do this through an action? Also, how can I get rid of the "filename_copy" filenaming behavior. I'd like to hit a button and have the file saved as the layer's name while overwriting the existing document without renaming it to whatever_copy.

    The bad news is that it's not possible with an action.  An action simply can't access a layer name.
    But the good news is that it's possible with a script.  Almost anything's possible with a script.
    But the bad news is I'm no script expert.
    But the good news is that there are script experts who hang out here.
    The even better news is that there's a Photoshop scripting forum.
    Best of luck! 
    -Noel

  • [CS3][JS] Selecting Layers by Name

    I'm trying to design a script to select layers by a given name. And then PDF layer1 (base) and certain items that are on each layer 1 at a time so I have multiple different pages. But the PDF thing doesn't seem to be much of an issue. I just can't select the layer by name.
    This is what I have so far:
    var myDocument = app.documents[0];
    var circusLayer = myDocument.layer[Circus];
    circusLayer.visible = false;
    Thanks!

    Hi Chris:
    var circusLayer = myDocument.layers.item("Circus");
    Thanks,
    Ole

  • Problem with "Create New Extrusion from Selected Layer" CC 2014

    Hello, I'm experienced with Photoshop but am new to 3D text in Photoshop.  I type in some text and convert to a shape.  When I choose Create New Extrusion from Selected Layer I get  dialog box I don't see in any tutorials.  It says "You are about to create a 3D layer.  Would you like to switch to the 3D workspace?  Yes/No, Don't show again."  Which should I use for 3D text? 
    If I choose Yes, all the panels go away and the content in the tool options bar (ribbon?) just under the menu bar go away.  I have to restart Photoshop to get the tool options back.  What could I be doing wrong?
    Thanks - Dave

    I just chose "No" and didn't look back.  I like my workspace just as it is, and don't prefer Photoshop to change it for me under this particular case.
    You can make the 3D panel visible yourself via Window - 3D.  I find it's a good alternate for the Actions panel, as I don't have any actions at the moment that work in the 3D world.
    The panels you'll want to see easily if you work on 3D are the 3D panel and the Properties panel, among a few others.
    Regarding getting your workspace back the way you like it...  Note the little selector near the upper-right corner of the Photoshop main window.  That can be used to select a workspace.  I suggest you experiment and get familiar with the concept of workspaces.  You can define your own and save it with a name, and that truly can be helpful.
    -Noel

  • How to update html pannel when selecting layer?

    Hi scripting friends.
    I'm making a panel to display selected layer name.
    Even Notifier is not work for this.
    Thanks for help!

    In HTML make sure you register for events correctly. See these instructions: http://www.davidebarranca.com/2014/02/html-panels-tips-7-events-photoshopregisterevent-pho toshopcallback/
    Make sure you are running the latest version of 14.x and 15.x.

  • Could not complete the new 3D extrusion from selected layer command because the path is too complex.

    I was trying to do a photo of mine like in this video but its not working help needed. thanks.
    http://www.youtube.com/watch?v=egyLY78H7nE
    When I tried the 3D I got an error message that said (could not complete the new 3D extrusion from selected layer command because the path is too complex.) what does this mean and how can i fix it?

    There was a bug at one time where really simple paths (like a triangle, for example) could cause that error.
    Is your path really simple (I don't plan to go watch the video)?  If so, have you installed the latest update for Photoshop?  That bug may have been fixed already.
    If it's not that, it's possible that if your path is really complex and simply exceeding Photoshop's capability.
    -Noel

  • Display workorder   only related to   vendor selected in Vendor  name UDF

    Hi ,
    I am using SAP 2007 PL 18 ,
    In a Goods Issue Form I am  created two UDF 1) Vendor Name 2)  Work Order Nos .  
    Here queries related  Workorder No. Display workorder   only related to particular  vendor selected in Vendor name UDF  .
    Pl provide me FMS query.
    Thanks
    nitin

    Hi Nitin,
    My question is How you can know these Work orders are related to particular Vendor? Any relation is there between the Vendors and work orders?
    Also what you calling as Work Orders? I think it is Purchase Order?
    If it is PO, then try this
    Select T0.DocNum from ORDR T0 where T0.CardCode = $[$OIGE.U_BPCode] and T0.Status = 'O'
    The above query will show only the Open PO list. If you want all POs then remove the T0.Status condition.
    Regards,
    Bala
    Edited by: Balakumar Viswanathan on Jan 3, 2011 11:13 AM

  • How to make the selection screen field names to apper as in logon language

    hai
    the selection screen field names should appear
    as that of logon language
    and <u>before that once i logon with a language
    it should pop up the (some)message in the logon language</u>.
    For the selection screen filednames to appear as that
    of the logon language whether i have to maintain the textelements for all screen fields in all possible languages or i have to write only in english and tell mentioning it to change

    In <b>SE38</b> --> Goto --> Translate.
    Choose target language, and start making the translation -;)
    Greetings,
    Blag.

  • Selected TOC style Name

    Hi All,
    Simple question for you...
    How can I alert the selected TOC style name.
    We are creating huge tool. Based on the selection Toc Style, we will process the multiple document.
    For example I want to alert the Toc Style CCC(tick mark) name in this document.
    Trying Code:
    var myTocStyle = app.activeDocument.tocStyles.selectedIndex;
    //~ var myTocStyle = app.activeDocument.tocStyles.item(-2);   //Dont want this concept
    Very urgent request. Please help.
    Thanks
    Beginner_X

    From:
    myStory.storyType
    you can determine that a story is a TOC, but how do you get from there to the TOC Style that was used to create said TOC?
    This was the question that was bugging me back in CS3 days and I see no improvement in the CC object model. Stories don't have an associatedTOCStyle property. But maybe you can get at this by lateral thinking. If a story was created as a TOC then it has certain paragraph styles in it. If the TOC Styles are designed to have unique paragraph styles that identify the TOC Style, then you're home and dry. For example, you could have a ParagraphStyleGroup for each TOC Style and the name of that group could be the same as the name of the corresponding TOC Style.
    Of course, this assumes you have control over the template for the project so that this relationship can be relied on. But given that, you can start with a text selection. Check the applied paragraph style, look at the name of its parent and bingo: there's the name of the TOC Style.
    I'm not sure if this helps in your situation.
    Dave

  • How to save a slice of selected layer or selected object

    I am new to Fireworks CS3. I have a layered PSD and want to
    create slices (or images to be used separately on a web page via
    Dreamweaver) from certain selected layers or certain objects
    showing the selected layer and / or object only. I tried and got a
    slice that contains all visible layers cropped to the size of the
    object I wanted. Can someone point me to a resource that will show
    me some tutes or offer an explanation?
    For example, suppose I have an apple as a background image on
    a bottom layer, with other images on other layers overlapping the
    apple in my psd file. How do I create a slice of just the apple?
    And, suppose I have an apple, an orange and a banana on the
    same layer, but I want to create a slice of each fruit
    individually. How is this best done?
    Thanks.

    WorWicWebmaster wrote:
    > I have dealt with this type of problem for years now. I
    have been asking for a
    > solution and oddly enough, Microsoft has provided the
    solution. The latest
    > release of Expression Design 2 now has slicing support.
    They took it to the
    > next level and allow you to indicate which layers, even
    which elements on
    > layers, you want to be "visible" to the slice. If a
    layer or element is not
    > marked as visible, it will not be exported with that
    slice. It's as if the
    > graphic(s) were unseen by the slice.
    >
    > This is a very elegant solution to an old problem ever
    since slices were first
    > introduced. I sincerely hope Adobe takes notice of how
    competitors are
    > innovating similar tools. I personally prefer Fireworks
    over Expression Design,
    > but I've been using Design lately just for this slicing
    feature.
    >
    Yes let's hope they do
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    Adobe Community Expert
    http://tinyurl.com/2a7dyp
    .:Author:.
    Lynda.com -
    http://movielibrary.lynda.com/authors/author/?aid=188
    Peachpit Press -
    http://www.peachpit.com/authors/bio.aspx?a=d98ed798-5ef0-45a8-a70d-4b35fa14c9a4
    Layers Magazine -
    http://www.layersmagazine.com/author/jim-babbage

  • Can't Select/Edit File Name Text - they go blank

    Sometimes when I try to select a file name to edit it, the name disappears when I first click it. This often happens in list view. If I switch to icon view, most of the times, but not always, I can then select the file name text. Sometimes if I switch back to list view, then I can select the file name text as expected, but again not always.
    It is intermittent so I can't give any consistent info on how or when it happens.
    Thanks,
    Steven

    Try this. Select the file and hit the enter key. Does that highlight the name without deleting it? If so, adjust your mouse click settings and see if that fixes the problem. If not, create a new admin account, log into, and see if the problem's gone. Report back.

  • Photoshop CS5 Hangs on Layer Group name edits

    Layer Group name edits are causing my PS CS5 to hang repeatedly. At first I thought it was the document I was working in, so I created a generic document, and was able to replicate the problem in the new document.
    With a .psd open, in the layers pallete, I have a Layer Group (A) that contains multiple sub layer groups (B) which contain additional sub layer groups (C). So the hierarchy is a three level layer group. At the sub-most layer group (C) I need to rename the groups to "Three-set colors". Since I have fifteen groups that all need the word "Three" in their labels, it would be most convenient to be able to highlight the word "Three", copy to clipboard and paste. I type in the word "Three" in the layer group name (not in the properties insector) and highlight the word "Three". Thats when PS CS5 hangs, and I have to reboot my system to unfreeze Photoshop. Only Photoshop hangs, the system does not crash. This happens in both 64 and 32 bit, old or new docs.
    The plugins I have are Mask Pro x64 (OnOne) and Sitegrinder x32 (Medialab), but they are not activated when the hang occurs.
    Any ideas?
    PS CS5 12.01 x64
    Win 7 Ultimate
    12 gb ram
    i7 960 @ 320
    ATI Radeon HD 5700
    4x HD's

    I wasn't able to reproduce the problem with either Photoshop CS5 32 bit or x64.  That says there's something different about our systems, and that there's likely not a systemic problem in Photoshop.
    Chris Cox, who replied above, is an Adobe Engineer, by the way.
    I was able to replace parts or all of the names with, or insert the word Three in front of existing layer names.
    Are you seeing any errors in your Windows system logs at the time the hang is occurring?
    Have you updated all your software (e.g., video drivers, Windows Updates, etc.)?
    -Noel

  • Select layer/object will not move in PS, but will move another layer. Need help

    I appreciate the help ahead. I cannot figure this out with my Photoshop CC.
    Basically when I select a layer on the right, and then go to move the object in that layer, it moves a different layer behind it.
    In the screen shot below on the left I am selecting the artwork layer on the right, which is the flip flops on the shirt.
    From here I can use the arrows to move the graphic. However, as soon as I use the mouse to select the flip flop graphic and go to move it, the layer selection on the right jumps to the shading and moves a background layer.
    What am I doing wrong? Super frustrating!
    Running Win 7 x64 8 gig ram, i7, 2 gb Nvidia card.
    Thanks!
    Jason

    You probably have Auto Select Layer on. (Options bar)

Maybe you are looking for