(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

Similar Messages

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

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

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

  • 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 );

  • How do I remove a number sequence using batch rename

    Hi
    I know I've done this in the past but cannot seem to work it out today.
    I have a series of images "_####_[layercompName].png".  I would like to remove the underscores and numbers.  The underscores removal is easy, but how do I remove the numbers (####) when they are different for each filename?  I would like the end result to be [layercompName].png
    The reason I have these filenames in the first place is that I have run the photoshop script "layer comps to files", and this adds a number sequence prefix.  I have tried to alter the script following various instructions I've found from trawling the internet (this one included How do you remove the number sequence when exporting layer comps to files? CS6. Windows 8.) but without any luck.  So now I'm resorting to batch renaming in Bridge.
    Thanks!

    Here you go, taken straight from: DesignEasy: How to Remove Sequence Numbers and Empty Spaces When Exporting Layers and Layer Comps
    Run Adobe Bridge and navigate to the folder with exported files.
    Select all files which have sequence numbers.
    Go to Tools > Batch Rename.
    Choose: String Substitution from the first drop-down list in New Filenamessection. From the second drop-down choose: Original Filename. In the Find: text field type: _\d{4}_ (underscore, backslash, letter d, open bracket, number four, closed bracket, underscore). Leave Replace with: text field blank. Ensure that you have Replace All and Use Regular Expression checked as shown on the screenshot below.
    Click on the Preview button in the top right corner and ensure that files will be renamed as you want.
    Click on Rename button and you are done.
    In case you are first time doing this and you still have doubts if everything will work as expected, check Copy to other folder option when renaming files. This option is located near the top left corner under: Destination Folder.
    Another thing I want to mention is to remove everything that you have below String Substitution options. In case you see additional renaming options just click on minus (-) sign on the right side to remove them.
    How to remove/substitute empty spaces in the file name using Adobe Bridge
    It is pretty similar process. The only difference is that you should type: \s (backslash followed with letter s) in the Find: text field. You can leave Replace with: text field blank or to type underscore.

  • Adobe Bridge Batch Rename Stopped Working

    ive been using bridge exclusively to rename/
    organize my files and today for some odd reason it just will not work. i select the files i wish to rename and then select batch rename and name/numer the files as ive always done before and when i click rename nothing happens at all. i cleared out my cache to no avail and im now officially stumped. any help is appreciated. thanks!

    Your problem does seem odd.  Difficult to troubleshoot by remote, so run a few tests and see if you can narrow the problem down.
    By any chance are you trying a batch re-name of files on an external drive?  If so may be permissioning problem.
    Do you have this problem in all folders or just one?  If one there may be a contaminated file or name (i.e. flower.jpeg.jpeg)
    To avoid fouling up your files copy a dozen or so and put in "test"  folder then run these tests.
    Can you do a simple rename of one file?
    Can you do a batch rename of one file?
    If the above is true can you do batch rename for all files in this folder?
    If so does the extension make any difference - jpeg, psd, etc.?

  • Adobe Bridge CC: Batch Rename using any metadata field

    How can I add certain Metadata fields to the pull down menu in the batch rename function?
    I need to do a batch rename of files, but using metadata fields that are not available as an option on the pull down menu.
    Hoping to use any or all of these:
    Audio : Artist, Album, Genre
    IPTC Core : Description, Keywords, etc..

    I don't think there is any way in which you can add to the built-in functions…
    Unless this is actually provided by one of the Adobe start-up scripts… ( I've not see it when digging about )
    You would probably need a scripted solution that can give you drop down menu of the extra options you want.

  • How can I Batch Rename Files in Aperture?

    Yesterday I imported some new photos and accidentally used the settings from my last import which named my images in a way that needs to be changed. I have already rated and edited many of the images so I don't want to reimport them from my memory cards.
    Is there a way to batch rename the images - preferably to the original file name from the camera? If not a custom name would be fine.

    Metadata->Batch Change

  • Batch Renaming with Counter

    I am trying to do batch renaming with a counter. Unfortunately every time I try to use a counter, it stays the same number.
    For example/
    I have two clips that I want to rename Ceremony 1 and Ceremony 2. When I do the batch renaming, the clips change to Ceremony 1 and Ceremony 2. The counter doesn't work.
    I could do keyword collections or rename them individually, but I have too many clips.
    I hope someone could help me.

    I figured it out. As you saw above, I wasn't having a problem batch renaming the title of the clips. I was having a problem with the counter. I learned in a previous posting that when you change the name of a subclip of a clip, it changes the name of both the original clip (clip in event browser, not hard drive) and the other subclips associated with it. It doesn't matter how you rename the clip (changing the name in the Name box of the Inspector, change it by clicking the name of the clip once in the event browser and typing it in, or using custom naming (click on the gear button in Inspector to find it), the name will always change correctly. For some reason (I guess a FCPX thing lol), you can't use the counter in custom naming correctly unless you change the original name through custom renaming. If you change the original name of a clip the other two ways, then try to change the new name of the clip using custom renaming with the counter, the counter will always stay the same number.

  • Batch rename in Adobe CC Bridge does not work. Is there any fix for this problem?

    Hi,
    I'm using Adobe CC Bridge to batch rename a folder of RAW files. Version 6.0.1.6.  I've got the latest Mac Pro running Maverick.  I set up the parameters in the Batch Rename tool, but when I hit Rename, nothing happens.  Is there anything I can do to fix this problem?  Is anyone else experiencing this?  Adobe can you fix this bug?

    I am experiencing this same (or related) bug with using the batch rename inside of Bridge CC (Mac OS X 10.9.5).
    First I filter out a subset of a folder of images that I want to batch-rename, then on the 12 or so thumbs I selected, I invoke the "batch-rename" dialog box... it presents its usual options, which work the first time. Subsequent attempts fail.
    I close the search filter, I re-type my filter, I close the bridge window, re-open the bridge window, etc. to no avail.
    It's interesting to note at this point, the program won't quit; it has to be force-quit.

  • Batch Rename Sequence Letter Doesn't Start with A

    I'm using Adobe Bridge CS3 to rename files.
    Several of the files require me to use the SEQUENCE LETTER function under BATCH RENAME.
    However, the names of the files contain a sequence of letters that start in the MIDDLE of the ALPHABET (i.e.  C, D, E, F, G, etc...)
    I can't find an option to let me start lettering form a letter other than A.
    Help!
    Thanks,
    jjfosho

    I have 3 monitors hooked up and running, the only port not in use is the mini display port (I do not have an adapter).
    All 3 screens are blue and the mouse and key board are not responsive.
    If i take out the other card (ATI Radeon HD 2600) it Tells me I need to restart. Every time i do it comes up with the same thing.
    Is the card Bad or something else?

  • Adobe Bridge CC Batch Rename and File Extensions

    I use Adobe Bridge CC on my macbook pro that is running OS X 10.8.5  When I batch rename files within Bridge it automatically drops the file extension. I am able to add the extension within the naming process but would prefer if it simply defaulted to the existing extension of the files being renamed. On occasion it does do this and then the next time it is gone. What am I doing wrong?

    I don't think there is any way in which you can add to the built-in functions…
    Unless this is actually provided by one of the Adobe start-up scripts… ( I've not see it when digging about )
    You would probably need a scripted solution that can give you drop down menu of the extra options you want.

  • Batch rename

    Hello Adobe community,
    I want to batch rename about 50 pics but the Problem is that the part I want to edit is at every Pic different.
    For example:          _0000_00 Loadscreen      _0001_01 Default       _0002_02 Productdetail      and so forth
    The Part I want to delete is _0000_ ist this possible in Adobe Bridge? Or with any other programms?
    The best way would be able to select the first 6 cyphers? Is this Possible?
    Thanks for your help

    Haha Lol just asked a friend if he knows how to and he told me the same thank you!!! Really awesome tool!!

Maybe you are looking for

  • Help with removing minor animation?

    hello can smeone please help me remove this minr animation from this flash file. the animation i would like to remove is the one dat appears in the start and gives it the effec of moving the menu from left to rite. i have gone thoguh the all the movi

  • Outlook Shared Contacts Sync Issue

    **Before i start, i posted this in the Outlook section and was told to post it the Outlook for Exchange section.. So i posted this in the Outlook for Exchange section and the Moderator tells me to post it in the Outlook section.. So i'm being thrown

  • Multiple EJB clients blocking

    I tried to ask this question a few months ago, but I must not have given enough details for anyone to even guess what my problem might be. So I created a simple example to demonstrate what's happening. I have a cluster of 2 WL servers (7.0) running o

  • [Q] How to merge 2 differents XY Graph?

    Hi, I'm currently having a stupid problem, at least I hope. I would like to plot the XY graph 2 and the other one on the same graph, but I'm just not able to. I tried to merge them in several ways, but it's not working.  I know there is a probably a

  • I rented a movie on my iphone but 20 minutes into it it said could not load. Why won't it work?

    An ideas on how to make it play?