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

Similar Messages

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

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

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

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

  • 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 for renaming selected shape layer items

    Does anyone know if such a script exists?
    That is to say, a script that renames the selected sub-items of a shape layer (paths, groups, shape generators etc).
    Am aware there's already scripts to rename selected layers and layer masks. Have attempted to rewrite these to deal with shape layer items, but to no avail.
    Many thanks

    I was able to rename them using these:
    "Path 1"
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Shape - Group").name = "MY NEW PATH NAME";
    "Shape 1"
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Graphic - Stroke").name = "MY SHAPE NAME";
    "Fill 1"
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Graphic - Fill").name = "MY FILL NAME";
    "Group 1"
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Group").name = "MY GROUP 1 NAME";

  • CS4 Bridge not returning to selected thumbnail after batch rename

    Using Bridge CS4.  Directory has several hundred RAW files.
    I grab some images from the middle of the bunch and do a batch rename.  Sometimes Bridge returns the thumbnail display to the ones that were selected, sometimes it doesn't.  When it doesn't, I have to scroll back down to my selected images. I can't figure out what is or isn't set that gets Bridge to return to my selected images instead of leaving me at the start of the thumbnails......

    First use the menu tools / cache / purge cache for folder, if still in trouble restart Bridge holding down option key to refresh preferences

  • Batch rename of selected files undoes all my groups

    I use groups extensively in Bridge CS3. Lately, when I batch rename files within a group, Bridge completely undones all the groups in the folder (2.5GB, total). Why is that happening?
    Thanks

    What are you calling "groups"?  Do you have all 2.5 gig of pictures in one folder?  If so, make each group its own folder.  Too many shots in one folder will cause slow rebuilding of thumbnails for the screen, and it can lead to crashes if you change views before build is complete.  Many try to limit to 200-800 per folder depending on size of images.
    The order of the picutures on the screen has to do with how you have the sort set up in the filter panel.  If you change the name it could reorder the display.

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

  • 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

    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!!

  • Batch rename in bridge

    i am having trouble with batch renaming. it was working fine previously and not sure what happened to cause it not to work. i am using a mac osx 10.6.3/ CS4.
    basically when i click on batch rename, it won't let me select "rename in same folder". it also will not highlight MAC OS in the compatibility line. i have restarted the program, computer, and cleared the cache. (same problem when i try to rename in a different folder)  any ideas?

    I am not familar with the workings of a Mac computer.  You would get a better response to post in the Mac Bridge forum.
    I suspect you need to reset the preferences which in a PC is press and hold the Ctrl key and click on start icon for Bridge.  You will get a reset window with 3 options.

Maybe you are looking for