Rename specified layers

Hi all, I work in CAD and regularly create PDF files which are imported into illustrator and illustrated there. I export a PDF where each CAD layer is its own page and have used this script (http://bruno.wyldco.com/multipagepdf/) to bring each of those pages into illustrator as its own layer. I have been able to figure out how to modify the script to also open the PDF directly into a template that I use every time. What im needing to figure out now is how i can automate the renaming of the layers. As i have it set now, the script brigns the 5 pages into my template as "Layer 4", "Layer 5", "Layer 6", "Layer 7", "Layer 8". That happens automatically, i cant set the names in the original script as far as i can tell. I would like the script to automatically rename the layers as such:
Layer 4 = Section
Layer 5 = Box
Layer 6 = Shell
Layer 7 = Fixtures
Layer 8 = Zones
If at all possible, id also like the script to do a select all on layer 8 (zones) and release all compound paths.
Is that possible to do via javascripting? Ive already tried a action, but as im sure you are aware, that doesnt work. i can get the release all compound paths to work as a action of course, but if it just ran automatically at the end of the script that would be best.

Ive found this script and it looks like it will select all compound paths.
var docRef=app.activeDocument;
for(i=0;i<docRef.compoundPathItems.length;i++){
var pathRef=docRef.compoundPathItems[i];
pathRef.selected=true;
I have a issue with using it though becasue i want to use it on only a specific layer and as it is coded now, it tries to do it on the whole document, and if the layers i dont want it to affect are locked, it throws a error that the target layer can not be modified. Also, what needs to be added to the code to release the compound path once it is selected?

Similar Messages

  • I have Speedgrade CS6 installed on my Mac and i have problems renaming my layers when I am grading. I was wondering if anybody can tell me how to rename my layers(Under the look tab). If not, is it because thins is not possible in Speedgrade CS6.

    I have Speedgrade CS6 installed on my Mac and i have problems renaming my layers when I am grading. I was wondering if anybody can tell me how to rename my layers(Under the look tab). If not, is it because this is not possible in Speedgrade CS6.

    No you can't. Renaming grading layers is a features since version 7 a.k.a. CC. Time to upgrade?

  • (Batch) Renaming of layers?

    Hello everybody!
    Is there a way of renaming all layers and sublayers of a given CS3-Illustrator file in a search-for-string substitute-with-string manor?
    Cheers
    Klaus

    Yupp, as Wade said, a script should be able to do this using the built-in JavaScript replace() and indexOf() methods. Should not be all too complicated (asssuming, there is a simple way to "walk" the layer/ group hierarchy), so someone may be able to quickly throw it together.
    Mylenium

  • Can I rename *selected* layers with scripting?

    Hello forum,
    Let me just start off by saying I know NOTHING about Photoshop scripting.
    But I recently encountered a need to rename a whole stack of layers in a certain file, so I went Googling...
    I came across this Rename Layers script -- http://morris-photographics.com/photoshop/scripts/rename-layers.html
    However, I was specifically interested in only renaming the layers that I have got selected in the Layers panel.
    This script unfortunately renames *ALL* layers in the document.
    Is it even possible to do what I want?
    Thanks.

    Is it even possible to do what I want?
    Yes. And the simplest thing to do is ask Trevor (the author) to tweak the script for you. If he's not slammed with other work, he should be able to help you out.

  • Rename multiple layers -- faster ?

    I'm looking to rename multiple layers quickly in one pass,maybe even including sub-layers ?

    Hi
    No not in iMovie'08
    But in iMovie'09 there is a kind of pic in pic. Drag a clip on-top of another in project window and
    You get a list to select from eg picture in picture.
    Only solution for iMovie'08 owner is to use QuickTime Pro
    where there is this function - You even can even do a video wall in QT-pro.
    But it works very differently. (read hard to use)
    Yours Bengt W

  • 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

  • Script to batch rename/number layers in Illustrator CS6

    Is there a script that I can use in Illustrator to batch rename all sub-layers? I would also like to be able to add sequential numbers to each layer too. I saw an older post that contained a script to do this but it seemed outdated and doesn't work on CS6. Here it is for reference, maybe someone can modify it to work for CS6?
    ////START SCRIPT////
    docRef=app.activeDocument;
    topLayers=docRef.layers;
    for(i=0;i<topLayers.length;i++){
    var currLayer=topLayers[i];
    var newNum=i+1;
    currLayer.name="Layer "+newNum;
    subLayers=topLayers[i].layers;
    for(j=0;j<subLayers.length;j++){
      var currSubLayer=subLayers[j];
      var newSubNum=j+1;
      currSubLayer.name="Layer "+ newNum+"."+newSubNum;
      subSubLayers=subLayers[j].layers;
       for(k=0;k<subSubLayers.length;k++){
        var currSubSubLayer=subSubLayers[k];
        var newSubSubNum=k+1;
        currSubSubLayer.name="Layer "+ newNum+"."+newSubNum+"."+newSubSubNum;
    ////END SCRIPT////

    You got me to investigate if other files and layer structures work, and I found one that partially worked. It stopped working after renaming the first top layer and sub-layers within that.
    Here's what kind of worked:
    before: after:
    Here's the structure that I ultimately want to edit and rename. They are the end levels, sub-sub-sub layers. I want all of them to be renamed to "applyColor1" "applyColor2" etc.

  • Rename all layers

    Hi!
    I've a problem to solve this issue.
    I need to rename a lot of layers (near 1000).
    I've found 2 scripts.
    First select object in the document, I've little edit it to cycle selection and remove selection. Here the result:
    // Adobe Illustrator CC Scripting
    // Select and rename layers
    var i, j, k, l;
    if (app.documents.length > 0) {
      var doc = app.activeDocument;
      if (doc.selection.length == 0) {
      for (i = 0; i < doc.pageItems.length; i++) {
      //Select object
      doc.pageItems[i].selected = true;
      // HERE I NEED TO RENAME SELECTED LAYER, BEFORE "remove selection".
      //Remove selection
      doc.pageItems[i].selected = false;
    Second script make me able to create var "pixelArea" of each object. I need to put that value at the end of each layer name.
    I try to put that between in the red area, but give me loop, so Illustrator die.
    if (app.documents.length > 0) {
      if (app.activeDocument.selection.length < 1) {
        alert('Select a path first');
      else if (app.activeDocument.selection[0].area) {
        var objects =  app.activeDocument.selection;
      else if (app.activeDocument.selection[0].pathItems) {
        var objects = app.activeDocument.selection[0].pathItems;
      else {
       alert('Please select a path or group.');
      var pixelArea = 0;
      for (var i=0; i<objects.length; i++) {
      if (objects[i].area) {
      var pixelArea = pixelArea + objects[i].area;
      if (pixelArea < 0) var pixelArea = -pixelArea;
      // HERE WE HAVE pixelArea VAR. NEED TO ADD THIS VALUE AT THE END OF SELECTED LAYER NAME
      // SOMETHING LIKE THAT: layer[n].name = layer[n].name + "-" + pixelArea;
    Both works (selection/remove selection and area calc, I don't find orking solution for layer name change), but when I combine them together generates the loop.
    I'm new with Illustrator scripts, every help could be appreciate.
    Really thanks!

    Welcome to the forum!
    Here's a quick script that might lead you to finding your answer...
        Dim aDoc As Document = app.ActiveDocument
      For Each pi In aDoc.PageItems
        If TypeName(pi.Parent) = TypeName(aDoc.Layers(1)) Then
          Dim layer As Layer = pi.Parent
          'you can rename here
          layer.Name = "New Name"
      End If
    Next
    Now this is written in .NET so you'll have to translate into JS, but you should get the idea.
    Thing is that if you choose to do it the way that you have chosen via pageitems, you will have to find the parent to find the layer that it is on. There might be an easier way if you can elaborate on your objective, at least as far as your first script is concerned...
    Does this help?
    -TT

  • Batch Rename PSD Layers to File Name Script?

    Hello,
    I just recieved several thousand .PSD files for a job containing a single layer (named "Layer 1") on a transparent background. I'm trying to find a way to batch rename the layer in each of these files as the file name, sans the file extension. Is there a script out there that can do this for me? Forgive me, I am not too hip with scripts.
    Windows 7 PC, CS6
    Thank you!

    Save the line below into a plain text file and give it the .jsx extension.
    app.activeDocument.activeLayer.name = decodeURI(app.activeDocument.name).match(/(.*)(\.[^\.]+)/)[1];
    Then create an action that runs that script. Then run File-Automate-Batch using that action.

  • Renaming Grading Layers

    All the kings horses and all the kings men couldn't find a Google answer to this one:
    In the Layers Window (not timeline), how to you change the name of a layer from "primary" to something more descriptive?
    Huge thanks,
    Andrew

    You can't.

  • Can't rename layers in Muse CC

    I used to be able to. What gives? I have rebooted my mac and still nothing. No other programs running. Double clicking does not open the text for renaming.

    I totally agree with the frustration of not being able to rename all layers. I have submitted it as an idea for a feature request here: Rename child layers (e.g: Rectangle to banner_fill or whatever!)
    Do vote for it and mention it to others who use Muse and get them to vote, even if it is a down vote as would be good to get a better idea of where this lies in terms of user "want", for us and the Muse team.

  • PLEASE add the ability to rename layers in Muse!

    Adobe, please allow us to rename ANY layer in Muse so we can know what each layer is. This is a very basic feature of nearly every Adobe software available and should be included in Muse ASAP.
    It is so difficult to find objects when the majority of them are defaulted to names like "rectangle" and "composition". Help us save time with this simple but extremely important feature!

    I totally agree. I have submitted it as an idea for a feature request here: Rename child layers (e.g: Rectangle to banner_fill or whatever!)
    Do vote for it and mention it to others who use Muse and get them to vote, even if it is a down vote as would be good to get a better idea of where this lies in terms of user "want", for us and the Muse team.

  • PS3 script to batch rename layers

    Sometimes, I make copies of layers (for example: copy little diamonds to align into a shape of the letter M). Each time I "alt+drag" the content in that layer (to make a copy of it), PS makes a copy and then appends the name of the layer to something like "diamond copy 3". After making a ton of copies (and because I'm anal about having actual names for each layer), I want each layer to read "diamond". Instead of manually renaming all these layers, is there a way to highlight the affected layers and choose to rename all layers according to what you want?

    Try this. Just select the layers you want 'copy' removed from and run this script.
    if( app.documents.length > 0 ){
    app.activeDocument.suspendHistory('Rename selected layers','removeCopyFromSelectedLayersNames()');
    function removeCopyFromLayerName(){
         if( getSelectedLayersIdx().length > 1 ){
              var selectedLayers = getSelectedLayersIdx();
              makeActiveByIndex( selectedLayers[0], false );
       var startLoop = Number( !hasBackground() );
       var endLoop = getNumberOfLayer() + 1;
       for( var l = startLoop;l < endLoop; l++){
            while( !isValidActiveLayer( l ) ) {
                l++;
              var oldName =  getLayerNameByIndex( l );
              var newName = oldName.replace(/\scopy\s?\d*$/i,'');
              putLayerNameByIndex( l, newName )
         if( selectedLayers != undefined ) makeActiveByIndex( selectedLayers, false );
    function removeCopyFromSelectedLayersNames(){
         var selectedLayers = getSelectedLayersIdx();
         for( var l = 0;l < selectedLayers.length; l++){
              var oldName =  getLayerNameByIndex( selectedLayers[ l ] );
              var newName = oldName.replace(/\scopy.*$/i,'');
              makeActiveByIndex( selectedLayers[ l ], false );
              putLayerNameByIndex( selectedLayers[ l ], newName )
         makeActiveByIndex( selectedLayers, false );
    function getNumberOfLayer(){
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
    var desc = executeActionGet(ref);
    var numberOfLayer = desc.getInteger(charIDToTypeID('NmbL'));
    return numberOfLayer;
    function getLayerNameByIndex( idx ) {
        var ref = new ActionReference();
        ref.putProperty( charIDToTypeID('Prpr') , charIDToTypeID( 'Nm  ' ));
        ref.putIndex( charIDToTypeID( 'Lyr ' ), idx );
        return executeActionGet(ref).getString(charIDToTypeID( 'Nm  ' ));;
    function putLayerNameByIndex( idx, name ) {
         if( idx == 0 ) return;
        var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putIndex( charIDToTypeID( 'Lyr ' ), idx );
        desc.putReference( charIDToTypeID('null'), ref );
            var nameDesc = new ActionDescriptor();
            nameDesc.putString( charIDToTypeID('Nm  '), name );
        desc.putObject( charIDToTypeID('T   '), charIDToTypeID('Lyr '), nameDesc );
        executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
    function getActiveLayerIndex() {
         var ref = new ActionReference();
         ref.putProperty( 1349677170 , 1232366921 );
         ref.putEnumerated( 1283027488, 1332896878, 1416783732 );
         var res = executeActionGet(ref).getInteger( 1232366921 )
                                                           - Number( hasBackground() );
         return res;  
    function isValidActiveLayer( idx ) {
         var propName = stringIDToTypeID( 'layerSection' );
         var ref = new ActionReference();
         ref.putProperty( 1349677170 , propName);
         ref.putIndex( 1283027488, idx );
         var desc =  executeActionGet( ref );
         var type = desc.getEnumerationValue( propName );
         var res = typeIDToStringID( type );
         return res == 'layerSectionEnd' ? false:true;
    function hasBackground(){
        var res = undefined;
        try{
            var ref = new ActionReference();
            ref.putProperty( 1349677170 , 1315774496);
            ref.putIndex( 1283027488, 0 );
            executeActionGet(ref).getString(1315774496 );;
            res = true;
        }catch(e){ res = false}
        return res;
    function getSelectedLayersIdx(){
         var selectedLayers = new Array;
         var ref = new ActionReference();
         ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
         var desc = executeActionGet(ref);
         if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
              desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
              var c = desc.count
              var selectedLayers = new Array();
              for(var i=0;i<c;i++){
                   selectedLayers.push(  desc.getReference( i ).getIndex());
         }else{
              var ref = new ActionReference();
              ref.putProperty( charIDToTypeID('Prpr') , charIDToTypeID( 'ItmI' ));
              ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
              selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( 'ItmI' )));
         return selectedLayers;
    function makeActiveByIndex( idx, visible ){
         if( idx.constructor != Array ) idx = [ idx ];
         for( var i = 0; i < idx.length; i++ ){
              var desc = new ActionDescriptor();
              var ref = new ActionReference();
              ref.putIndex(charIDToTypeID( 'Lyr ' ), idx[i])
              desc.putReference( charIDToTypeID( 'null' ), ref );
              if( i > 0 ) {
                   var idselectionModifier = stringIDToTypeID( 'selectionModifier' );
                   var idselectionModifierType = stringIDToTypeID( 'selectionModifierType' );
                   var idaddToSelection = stringIDToTypeID( 'addToSelection' );
                   desc.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelection );
              desc.putBoolean( charIDToTypeID( 'MkVs' ), visible );
              executeAction( charIDToTypeID( 'slct' ), desc, DialogModes.NO );

  • Renumber/Batch rename layers

    Hi, is there a quick way how to renumber or batch rename all layers in a file so they would be named in consequent numbers? Doesn't have to start from exact number, I was wondering if maybe there is some sort of script that would help me with that? Thanks a lot

    This thread is kind of old, but I found JET's script to be extremely useful, and like Steven, I also needed it to start from the bottom layer.  So I updated it a little.
    Set "fromTop" to "true" if you want it to name the top-most layer #1.
    Set "fromTop" to "false" if you want the bottom-most layer to be #1.
    ////START SCRIPT////
    #target Illustrator
    var docRef = app.activeDocument;
    var fromTop = true;                 
            // if true,  the top layer will be #1
            // if false, the bottom layer will #1
    renumberLayers(fromTop);
    function renumberLayers(fromTop){
        var topLayers = docRef.layers;
        for(i=0; i<topLayers.length; i++){
            var currLayer = topLayers[i];
            if(fromTop) var newNum = i + 1;
            else var newNum = topLayers.length - i;
            currLayer.name="Layer "+newNum;
            subLayers= topLayers[i].layers;
            for(j=0; j<subLayers.length; j++){
                var currSubLayer = subLayers[j];
                var newSubNum = subLayers.length - j;
                currSubLayer.name="Layer "+ newNum+"."+newSubNum;
                subSubLayers=subLayers[j].layers;
                for(k=0; k<subSubLayers.length; k++){
                    var currSubSubLayer = subSubLayers[k];
                    var newSubSubNum = subSubLayers.length - k;
                    currSubSubLayer.name="Layer "+ newNum+"."+newSubNum+"."+newSubSubNum;
    ////END SCRIPT////

  • Script: rename layers?

    Hi, is there a quick way how to renumber or batch rename all layers in a file so they would be named in consequent numbers? Doesn't have to start from exact number, I was wondering if maybe there is some sort of script that would help me with that? Thanks Pavel

    Thank you for the script. It is very useful.
    Could you help me with one thing? If I want to add letters "ca" in front of the number, where should I add "ca" and how to do that?
    The present script is 1, 2, 3, 4... on each layer.
    I want the script to be ca1, ca2, ca3, ca4... on each layer.
    Please help me out.

Maybe you are looking for

  • Program Crashing at sqlite_prepare3 help!!!!

    Hi guys, I am trying to make a program which inserts values into a sqlite database. For some reason my program crashes every time I press the button to insert the value. I have been trying to fix this for a long time but have not been able to fix it.

  • Hard drive not appearing in disk utility

    My hard drive on my MacBook crashed and I purchased a new one. I attempted to install the Mac OSX on the new hard drive, but have run into a couple issues. First issue I ran into was that I found out I had the wrong Install DVDs. I was able to format

  • Why Rich Text (HTML Only) format email introduces line breaks (paragraph marks) in the email body in html?

    A sentence in rich text (change in Options, Delivery format) appears as a single sentence in browser. But when I check the page source I see that sentence has been broken in to multiple lines. Why is this done? Isn't this a bug? When viewed in a brow

  • How to create a multiple existing users in exch 2013

    Hi  Do you know how to add a multiple existing users in Exchange 2013,only permits add one user at time. I need add 200 users. In exchange 2007 and 2010 this feature is possible through the management console It´s possible in Exchange 2013?

  • Mapping IDOC error

    Hi experts, I'm doing my first scenario IDOC to JDBC, i've problem with mapping I don't have seen any example in this forum of mapping IDOC, only i have seen the document : https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c09b775e-