[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

Similar Messages

  • Illustrator selecting layers by name then "make mask" command

    Hi guys,
    I'm trying to get a vbscript to do this maybe easy task for some of you
    I want to select 2 layers by name and then set the command :
    NameA = "nomdeCalqueA"
    NameB = "nomdeCalqueB"
    Set appRef = CreateObject("Illustrator.Application")
            Set idoc = appRef.ActiveDocument
            appRef.activeDocument.Selection = Empty
        For Each targetDocument In appRef.Documents
            countOfLayers = targetDocument.Layers.Count
            For layerIndex = countOfLayers To 1 Step -1
                Set targetLayer = targetDocument.Layers(layerIndex)
                    layerName = targetLayer.Name
                        If (InStr(layerName, NameA) = 1) Then
                        'then select my layer
                        End If
                        If (InStr(layerName, NameB) = 1) Then
                        'then select my layer
                        End If
    Next
    Next
            appRef.executeMenuCommand ("makeMask")
    I'm a little lost...
    Thank you for helping.
    Nems.

    iDoc.Layers("Name") in VB.NET ...  try it for VBS or possibly iDoc.Layers.Item("Name").
    Again -- just remember you're masking elements, not layers.
    Since you're more comfortable with VB maybe this could help, albeit it VB.NET. Translation should be pretty easy for you though. Note: I just pop in GUIDs to temporarily name the groups. You can use a different naming convention.
    Dim aDoc As Document = app.ActiveDocument
    aDoc.Selection = False
    Dim grp1 = CreateGroup(aDoc, "Layer 4")   'whatever layer name you want
    app.ExecuteMenuCommand("compoundPath")
    Dim grp2 = CreateGroup(aDoc, "Layer 2")   'whatever layer name you want
    app.ExecuteMenuCommand("makeMask")
    Private Function CreateGroup(aDoc As Document, layerName As String)
        Dim tmpGuid = Guid.NewGuid.ToString
        Dim layer As Layer = aDoc.Layers(layerName)
        Dim grp = layer.GroupItems.Add : grp.Name = tmpGuid
        For i = layer.PageItems.Count To 1 Step -1
            Dim pi = layer.PageItems(i)
            If Not pi.Name = tmpGuid Then pi.Move(layer.PageItems(tmpGuid), AiElementPlacement.aiPlaceInside)
        Next
        layer.PageItems(tmpGuid).Selected = True
        Return layer.PageItems(tmpGuid)
    End Function

  • Replace layer names in selected layers only

    I am using this script to find and replace words in layers. (The script only targets particualr words, rather than the whole layer name).
    I would like to make it so it targets selected layers only.
    I have found this script which loops through selected layers only, but I am not sure how to add the find and replace layer name functioality.
    Thanks for any help that can be offered.

    big_smile wrote:
    Looking through the guide, it doesn't seem "hasSelectedArtwork", is a built in function either. Are there any tutorials or guides that explain how to target selected layers?
    Wrong reference manual, see this one:
    http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/illustrator/scripting/cs6/Illustrator -Scripting-Reference-JavaScript.pdf
    Page 91 -- CHAPTER 1: JavaScript Object Reference
    Layer
    Property
    hasSelectedArtwork
    Value type
    boolean
    What it is
    If true, an object in this layer has been selected; set to false to deselect all objects in the layer.
    So as I talked about here:
    W_J_T wrote:
    Correct. Yeah there is no direct way unfortunately (like many things via scripting), thats why I suggested using "hasSelectedArtwork", that would work if you select the layer target when selecting your desired layers to rename.
    and...
    W_J_T wrote:
    if(layerReferenceString.hasSelectedArtwork == true){
         // relative code
    That would offer a way to know if a layer is selected or not.
    As far as I know that is the only round about way of knowing if a layer is selected via scripting.

  • Batch rename selected layers

    I'm trying to find a script that can help batch rename/renumber a group of selected layers.
    So far I've been able to find a script that renames every single layer in a Photoshop document (overkill). Or there's the CS6 Tab rename trick (too slow).
    I routintely export PSDs from Illustrator for use in After Effects. But in Photoshop, I'll get a couple hundred layers named <path> or <path> + <path> or <group>. Renaming by hand is out of the question. But I don't want to rename every layer the same.
    Any suggestions?

    I wrote one for you here...
    http://www.retouchpro.com/forums/photoshop-scripting/23234-script-find-replace-text-layer- names.html

  • 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

  • Is there a way to move everything forward when you stretch select layers?

    Hi,
    I have a comp with multiple animations happening.
    At some places in the comp I want to make layers appear longer.
    When I select these and stretch them - the remaining layers need to move forward in time to compensate.
    This doesnt happen and so the stretched layers over lap with upcoming (in the time line) layers.
    Is there a way to do this?
    Thanks in advance
    Kal

    You can command-select the layers you want to move and drag them forward or backward in time. It's easy. There is no way that I know of to do this automatically if you stretch a layer. AE does not have insert-and-ripple capabilities like a video editor does.
    Place or move a layer in time
    The layer duration bar represents the layer duration visually. The In, Out, and Duration columns in the Timeline panel represent the layer duration numerically.
    Note:
    To choose which columns are visible in the Timeline panel, choose Columns from the panel menu, or right-click (Windows) or Control-click (Mac OS) a column heading.
    These procedures move the entire layer in time.
    To set the In point or Out point numerically, click the number in the In or Out column for the layer in the Timeline panel.
    To move the In point or Out point to the current time, Alt-click (Windows) or Option-click (Mac OS) the number in the In or Out column for the layer in the Timeline panel.
    To move the In points of selected layers to the beginning of the composition, press Alt+Home (Windows) or Option+Home (Mac OS).
    To move the Out points of selected layers to the end of the composition, press Alt+End (Windows) or Option+End (Mac OS).
    To move selected layers one frame later, press Alt+Page Down (Windows) or Option+Page Down (Mac OS). To move selected layers 10 frames later, press Alt+Shift+Page Down (Windows) or Option+Shift+Page Down (Mac OS).
    To move selected layers one frame earlier, press Alt+Page Up (Windows) or Option+Page Up (Mac OS). To move selected layers 10 frames earlier, press Alt+Shift+Page Up (Windows) or Option+Shift+Page Up (Mac OS).
    To move the entire layer in time by dragging, drag the layer duration bar to the left or right. To snap the layer duration bar to significant points in time (such as markers, or the start or end of the composition), Shift-drag the layer duration bar.
    Note:
    When you drag a layer in the Timeline panel, the Info panel displays the name, duration, change in time, and In and Out points for the layer. 
    Before and after dragging the duration bar 
    Jeff Almasol provides a script on his redefinery website with which you can move selected layers as a group, aligning the group to a specific time in the composition.
    To the top 

  • 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.

  • How to identify selected layers in layer panel of Photoshop?

    Hi everyone,
    I'm working on a Photoshop plug-in, and I want to identify selected layers in layer panel.
    As I tested so far, didn't came up with a solution..
    If anyone can provide me a solution it will be greatly appreciated,
    Thanks in advanced..
    Nuwan.

    Looping through controls is indeed a inefficient way of doing what you want!
    With such a great number of controls, you could assign an appropriate callbackData to each of them when loading the panel. Next you could create an array of control IDs with all the LEDs and operate in the switch callback to turn on and off the corresponding led. A small example will be more clear:
    At panel load:
    int leds[200];
    SetCtrlAttribute (panelHandle, PANEL_SWITCH1, ATTR_CALLBACK_DATA, (void *)1); leds[1] = PANEL_LED1;
    SetCtrlAttribute (panelHandle, PANEL_SWITCH2, ATTR_CALLBACK_DATA, (void *)2); leds[2] = PANEL_LED2;
    SetCtrlAttribute (panelHandle, PANEL_SWITCH192, ATTR_CALLBACK_DATA, (void *)192); leds[192] = PANEL_LED192;
    In the switch callback:
    int CVICALLBACK switchOnOff (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2)
    int sts;
    if (event != EVENT_COMMIT) return 0;
    // Get the status of the switch
    GetCtrlVal (panel, control, &sts);
    // Set the led to the proper status
    SetCtrlVal (panel, leds[(int)callbackData], sts);
    return 0;
    For this solution to work, leds[] array must be global so that it is available to the control callback.
    An additional improvement could be to modify the panel loading so that swithces and leds are created programmatically. You could have a single switch/led pair set in the UIR editor and next have a loop that duplicate the controls, sets callbackData and loads the array of led ids.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • IDCS5: How to access selected layers in layer panel

    It seems the way to access the selected layers in layer panel has been changed in CS5.
    Here is a link to the code that worked with CS4, but it is not working on CS5.
    http://forums.adobe.com/message/1304622#1304622
    Is there some way to find out how it works in CS5?
    Thanks.

    Please check Panel Options > Thumbnail Size from the Layers Panel’s pop-up menu in the upper right corner.

  • 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.

  • HT2470 Why won't Itunes store my music library in my User/Music Folder, if I select my user name as a storage location in Itunes, Itunes creates folders for artist name right in my user folder, instead of in my user/music folder

    Why won't Itunes store my music library in my User/Music Folder? 
    If I select my user name as a storage location in Itunes, Itunes creates folders for artist name right in my user folder, instead of in my user/music folder.  This gets especially annoying because if I tell Itunes to store my "media" in my user/music folder, Itunes will then create a folder named "music" in my "music" folder and will also create additional folders in my user/music folder location to store other non-music media in as well. It is very annoying to see this lack of affinity for folders between two Apple created programs.

    Help iTunes locate your media folder:
    No content shows up in iTunes after updating
    http://support.apple.com/kb/TS1967

  • Need to select a directory name.

    I need a dialog that will allow me look through my computer and select a directory name only. The file name is automatically generated, I figured this part out.

    Thanks for your answers, but I already found how to use a "File Dialog Function" from looking at other postings. But I guess it's not working the way I am expecting.
    I attached a constant to the select mode input and set it to "existing dir" mode 3. Then attached a start path control to the start path.
    Now when the dialog opens to select a "directory", I can only select a file. The directory information is in the total file path but I really don't want to select on a file. I need to select a directory and have this information show up. I don't want to see a file name in the final selection.
    Any more information?

  • Can I cycle through and change the color overlay of certain layers by name using script?

    Can I cycle through and change the color overlay of certain layers by name using script?

    Sure. Ask in the scripting forum and refer to the scripting docs.
    Mylenium

  • Uanble to Select UWL-Configuration names from Current Configurations Tab

    Hi Team,
    In UWL , i have multiple configurations names in current Configurations Tab, Once i click on Current configuration Tab,  it is    selecting first Configuration name as a default one(it's prority is High).
    After that i am trying to select second(or anyone otherthan default) configuration name & Download the cnfiguration XML file, but i am unable to select second configuration name. 
    Could you please help on this?
    Thanks & Regards
    Sandeep.

    Hi Sandeep,
    I am not sure exactly where you are doing this.  Could you please step by step here in the thread?  Are you trying to select the 2nd xml file in the configurations through the admin tab and trying to download it but nothing is happening?  If so can you copy the jtechf and jtechs along with UWL/KM/J2EE/Portal versions and post them here in this thread?
    Best Regards,
    Beth Maben
    EP - Senior Support Consultant II
    AGS Primary Support
    Global Support Centre, Ireland
    Please see the UWL Wiki @
    http://wiki.sdn.sap.com/wiki/display/BPX/UWL%20FAQ  ***
    Please see the BPM Wiki @
    http://wiki.sdn.sap.com/wiki/display/BPMT/BPMTroubleshootingGuide ***

Maybe you are looking for