Script to rename the PSD layers

Hello

I have a lot of documents PSD and rename layers.

Layer names are like 'natural environment - natural environment - 103 89' and I want to the rename 'environment_89, environment_103' etc. in several layers.

I'm looking for a script for this.

Can someone help me?

Hello!

Try this:

CalcChangeNom.jsx

var doc = app.activeDocument;

If (doc.layers.length > 1)

{

I have = doc.layers.length

for (x = 1; x<= i;="">

{

var calqueSel = doc.layers [i - x];

calqueSelNom = calqueSel.name;

Result = calqueSelNom.split("");

If (result [0] == "natural" & result [1] == 'environment')

{

calqueSel.name = "environment_" + result [3];

}

}

}

Tags: Photoshop

Similar Questions

  • script to rename the layers in alphabetical order

    Hello world

    I have a name change script that works only on the numbers and I want to make it work for the letters too.

    What I want to achieve is to select a few layers-> load the script-> enter the desired name of the layer and brackets insert the letter of where to start. The script then iterates through the alphabet rename the layers and adding the letter from coresponding to the name and remove the brackets. For example, I select 4 layers, loading the script and when the guest comes on... Enter the name: test [C]. In the end, that I should have renamed layers testC testD, tests, testF

    Any help would be appreciated!

    Thank you

    So what you wanted, it is for renaming selected objects, no layers, right?

    Check this script, I took a different route, I added some comments, if you have problems with it, do not hesitate to ask

    // this script Renames selected Objects with a base name plus an incremental suffix
    // Carlos Canto // 07/03/2013;
    // http://forums.adobe.com/thread/1243774?tstart=0
    
    var doc = app.activeDocument;
    var sel = doc.selection;
    var rename = prompt("Enter the name and ONE character suffix (comma separated, no space):","test,A", "Increment Rename Selected Objects");
    if (rename!=null) {// quit if pressed Cancel
        var nameArray = rename.split(","); 
    
        var base = nameArray[0];
        var suffix = nameArray[1];
    
        var charCode = suffix.charCodeAt (); // convert the suffix character to Unicode
    
        if(sel.length>0){
            for(var z=0;z		   
  • Rename the selected layers in batch

    I am trying to find a script to rename/renumber lot, a group of selected layers.

    So far, I was able to find a script that renames each single layer in a Photoshop (overkill) document. Or there is the trick to rename CS6 (too slow) tab.

    I'm routintely export PSD in Illustrator for use in After Effects. But in Photoshop, I'll take a few hundreds of layers named < path > or < path > + < path > or < group >. Change of name by hand, it's out of the question. But I don't want to rename all the layers of the same.

    Any suggestions?

    I wrote to you here...

    names.html http://www.retouchpro.com/forums/Photoshop-Scripting/23234-script-Find-Replace-Text-Layer-

  • Script to rename the virtual computer by name DNS listed in VC

    I am very new to powershell, and I tried to understand this by using pieces of code I found, but nothing helped.

    I'm looking for a script to take the given DNS host name for a virtual machine listed in VCenter and rename the virtual computer.

    For example.

    Host01VM01 (as shown in Vcenter) - the DNS name of the "something.xyz.com".   VM and rename it "something.xyz.com" in Vcenter.

    To run the script only for a group called "Mycluster" you can do:

    Get-Cluster "My Cluster" | Get-VM | `
    Where-Object { $_.Guest.HostName } | `
    ForEach-Object { Set-VM -VM $_ -Name $_.Guest.HostName -Confirm:$false }
    

    This script will only work for VMS that have installed VMware tools and probably only for VM which are turned on.

  • Script to rename the layers at the same time

    Hello

    As a relationship of one sheet excel or any other format if it works. Is it possible to rename several layers at the same time.

    Thank you for your help

    Best regards

    Nanga

    Here is the InDesign scripting forum:

    Scripting InDesign

  • Need help with custom script to rename the layers

    Hello world.

    I need help to write a custom script (because I suck at it) that will allow me to go through all the layers and sous-calques for a specific name ('X') and give it a new specific name ('Y').

    I have had success using the script below, but it does not work on any text layers names where the text layer was previously particularly well-known in 'X' and now changed needs.

    Any help is greatly appreciated.

    * Note: this script was originally used to find any layer with 'Copy' in its name and remove with anything after (to correct the problem of duplication of layers by adding this text).

    This is why the function is named removeCopy. It works for renaming layers also - just not a layer of text unfortunately.

    #target illustrator

    function removeCopy() {}
    If (app.documents.length == 0) return;
    var app.activeDocument = docRef;
    recurseLayers (docRef.layers);
    }
    removeCopy();
    function recurseLayers (objArray) {}
    for (var i = 0; i < objArray.length; i ++) {}
    ObjArr [i] .name = ObjArr [i].name.replace (/ \s*current name\s*\d*/, 'new name');
    If (objArray [i] .layers) recurseLayers (. layers.length > 0 ObjArr [i]);
    }
    }

    I finally found something after searching forums for a week. My confusion was related to the way Illustrator treats real layers against text/path/object "layers." Instead of layers, I had to use the pageItems in the script. The code below works. Thanks to Gustavo for his answer in another thread and Carlos I thank you for this looking too good! You're great to be ready to help models do more advanced things with Illustrator.

    var doc = app.activeDocument;
    var items = doc.pageItems;
    for (var g = 0; g)
        elements [g] .name = elements [g].name.replace ('Century Schoolbook text line', ' MonogramText: Century Schoolbook ");
    };
    App.Redraw ();
  • script batch rename/number of layers in Illustrator CS6

    It is a script that I can use in Illustrator for batch rename all sublayers? 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 she seemed outdated and does not work on CS6. Here is the reference, maybe someone can modify it to work for CS6?

    START THE 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] intact;
    for (j = 0; j < subLayers.length; j ++) {}
    var currSubLayer = sublayer [j];
    var newSubNum = j + 1;
    currSubLayer.name = "Layer" + newNum + "." ' + newSubNum;
    subSubLayers = intact sublayer [j];
    for (k = 0; k < subSubLayers.length; k ++) {}
    var currSubSubLayer = subSubLayers [k];
    var newSubSubNum = k + 1;
    currSubSubLayer.name = "Layer" + newNum + "." "' + newSubNum + '. ' + newSubSubNum;
    }
    }
    }

    END SCRIPT.

    So those who were not yet sleeping, but they looked as if they were layers? I thought they were layers because it does not look as if they were inside any layer... but he could simply have the screenshot?  But I were considered and rejected this possibility when you first look at it.

    To start at 0, where it says var newNum = i + 1, just change var newNum = i;

  • Script to rename the names of information link

    I'm working on the conversion of a catalogue of old customers from Quark to Indesign.  I use Indesign CS4 on Windows Vista. I used Markzware Q2ID to convert indesign catalog with too many problems.  But I ran into a big problems with the images.  They will be automatically re-issued.  After digging around, I found the problem.  For some reason any all Image names also include the path structure.

    For example

    Link Info

    Name: BDA - 12:Users:graeme:Desktop:FSIP back-up: _Collected:02405 PESA AftMkt EAST: photos: M587524. EPS

    Path: BDA - 12:Users:graeme:Desktop:FSIP back-up: _Collected:02405 PESA AftMkt EAST: photos: M587524. EPS

    Luckly that all names have the same problem.  So I hope find or write a script that can simply go through the indesign document and find/replace all the names link to remove "BDA - 12:Users:graeme:Desktop:FSIP back-up: _Collected:02405 PESA AftMkt EAST: photos:

    I know it is a very simple problem, but it's my first real attempt to script something in Adobe.  Anyone have any good ideas or tips on how I could do this?

    Thank you

    VIC Bushfield

    Victor,

    The conversion program totally corrupt links in your document: myLink.filePath is just empty string, myLink.name, this is what should have been myLink.filePath (this is info from ESTK).

    Here is a new version of the script - it rebuilt to the files located in the folder NewLinks on the desktop. Change this line

    var myNewPath = '~/Desktop/NewLinks/' + MyName;

    to the location of your links.

    WARNING - I tested it on Mac, because do not have a copy of CS4 for Windows.

    Kasyan

    //----------------------------------------

    indesign #target

    If (app.documents.length == 0) {}
    Err ("no document open. Please open a document and try again. ", true);
    }

    myDoc var = app.activeDocument;
    myLinks var = myDoc.links;
    var myCounter = 0;

    If (myLinks.length == 0) {}
    Err ("this document contains no links.", true);
    }

    for (i = myLinks.length - 1; I > = 0; i--) {}
    myLink var = myLinks [i];
    var myArr = myLink.name.split(":")
    var myArr = myName [myArr.length - 1];
    var myNewPath = '~/Desktop/NewLinks/' + MyName;
    var myNewFile = new queue (myNewPath);
    If {(myNewFile.exists)
    myLink.relink (myNewFile);
    myCounter ++;
    }
    }
       
    If (myCounter == 1) {}
    Alert ("a file has been relinked.", "Completed");
    }
    ElseIf (myCounter > 1) {}
    alert (myCounter + "files were relinked.", "completed");
    }
    else {}
    Alert ("Nothing has been relinked.", "completed");
    }

    function err (e, icon) {}
    Alert (e, "Update path names Script", icon);
    Exit();
    }

  • Rename the layer random script

    Hello, im trying to make a script to rename the layer like this:

    "anyname. RGB"in"RGB ";   "anyname. CMYK"to"CMYK. "

    I found a that rename, but only with the name of the layer exactly and I have a lot of layers with random names before the ".rgb".

    can someone help me figure out how to do?  THX

    Oh, it's easy. This script will get the name after the first point. If there is more than one point, then it will get only the name between the first and the second point.

    #target photoshop
    var doc = activeDocument;
    var counter = 0;
    countLayers (doc);
    
    function countLayers(p){
          for(var i=0;i1){curLayer.name = lName[1]}
                counter++
                try{if(!p.layers[i].kind){countLayers (p.layers[i])}}
                catch(e){}
                }
          }
    
  • Photoshop layer redesign, rename the script for Illustrator

    The Photoshop scripting guru Paul R more to RetouchPro has created a really cool to rename script and layers of selected Photoshop batch numbers. I did find something similar on the side of the Illustrator.

    He gave his permission for me to post it here in hopes that some Illustrator scripting genius could come up with a similar script for Illustrator. It would be terribly difficult to convert into something that could use Illustrator?

    http://www.mediafire.com/file/g7usr73u0236p0a/rename _ & _Renumber_Selected_Layers.jsx

    http://www.mediafire.com/file/dbah74x13bsa74c/rename _ & _Renumber_Selected_Layers.jsx.zip

    rename-layers.png

    Hola Julio, I updated the script to rename the sublayers or visible layers and also fixed the color

    #target illustrator
    
    main();
    function main(){
        if(!documents.length) return;
        //var allLayers = app.activeDocument.layers;
        var win = new Window( 'dialog', '' );
        g = win.graphics;
        //  var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]); // CS5
        var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.50, 0.50, 0.50, 1]); // CS6
        g.backgroundColor = myBrush;
        win.orientation='stack';
        win.p1= win.add("panel", undefined, undefined, {borderStyle:"black"});
        win.g1 = win.p1.add('group');
        win.g1.orientation = "row";
        win.title = win.g1.add('statictext',undefined,'Rename Visible Layers or Sublayers');
        win.title.alignment="fill";
        var g = win.title.graphics;
        g.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
        win.g5 =win.p1.add('group');
        win.g5.orientation = "column";
        win.g5.alignChildren='left';
        win.g5.spacing=10;
        win.g5.st1 = win.g5.add('statictext',undefined,'New layer name');
        win.g5.et1 = win.g5.add('edittext');
        win.g5.et1.preferredSize=[250,20];
        win.g10 =win.p1.add('group');
        win.g10.orientation = "row";
        win.g10.alignment='fill';
        win.g10.spacing=10;
        win.g10.st1 = win.g10.add('statictext',undefined,'Serial Number');
        win.g10.et1 = win.g10.add('edittext',undefined,'1');
        win.g10.et1.preferredSize=[50,20];
        win.g10.et1.onChanging = function() {
          if (this.text.match(/[^\-\.\d]/)) {
            this.text = this.text.replace(/[^\-\.\d]/g, '');
          }
        };
        win.g10.st1 = win.g10.add('statictext',undefined,'Length');
        var nums=[2,3,4,5];
        win.g10.dl1 = win.g10.add('dropdownlist',undefined,nums);
        win.g10.dl1.selection=0;
        win.g15 =win.p1.add('group');
        win.g15.orientation = "row";
        win.g15.alignment='fill';
        win.g15.cb1 = win.g15.add('checkbox',undefined,'Reverse layer order');
        win.g15.cb2 = win.g15.add('checkbox',undefined,'Rename Sublayers Only');
        win.g100 =win.p1.add('group');
        win.g100.orientation = "row";
        win.g100.alignment='center';
        win.g100.spacing=10;
        win.g100.bu1 = win.g100.add('button',undefined,'Rename');
        win.g100.bu1.preferredSize=[120,30];
        win.g100.bu2 = win.g100.add('button',undefined,'Cancel');
        win.g100.bu2.preferredSize=[120,30];
        win.g100.bu1.onClick=function(){
            if(win.g5.et1.text == ''){
                alert("No layer name has been entered!");
                return;
            }
            win.close(0);
    
            var sublayersOnly = win.g15.cb2.value;
            var visibleLayers = [];
            getVisibleLayers (app.activeDocument, visibleLayers, sublayersOnly);
    
            if(win.g15.cb1.value) visibleLayers.reverse();
    
            for(b=0; b		   
  • Extend the 'footage' imported PSD layers

    I imported a layered Photoshop file into After Effects as a model in layers with several layers of "footage".psd:

    Screen Shot 2016-06-27 at 1.23.33 PM.png

    I have created and edited the comps in the 20 main comp with animations and effects. Now, I need to extend the .psd layers (all 7 s ~) to the length of the main comp(20s).

    I tried dragging to extend their regions and right click > time > enable time Remapping(this allows me to extend the region with keyframes, but the content still ends proportionally short of the containing comp duration).

    When I right click on the layer of .psd and click on 'Open Source layer', the preview displays the duration of the layer extending at once as it shows in the timeline(~7s)...

    icZAR.png

    but green "render bar" only goes to 5s. And no content is visible while the playhead is at 6s, below...

    sWEMD.png

    This is also when I drag the playhead in the timeline main comp - layers with this problem disappear to 5s, even if their areas extend to 7s.

    1. I need to get these parts of layer to increase the length of my 20 years comp.

    2 it seems that the source of the layer is 5 s when I "Open Source layer", then even if the region is currently being extended to 7 s ~, 'content' only goes to 5s.

    How can I extend it to 20 seconds without doing all my images keys/animations/effects all over again?

    Or is there a way to re - import only the layers to lasting longer, but keep all my keys/animations/effects images.

    Using the latest Photoshop CC 2015.5 v2015.3 & after effects CC.

    Thank you!

    Sure sskaz is on, check if there is a timeline attached to your psd in Photoshop and delete it:

    You can also freeze your layers in After Effects and make more time

  • Replacement of all PSD layers when a PSD file name has changed

    Does anyone know how to quickly add a link to all layers in a PSD file, if the name of the PSD file has been changed?  At present, it seems that I have to add a link to each individual one layer.

    For example, I have a PSD with 100 + layers imported in my project, but I would now like to rename the PSD file. Of course, when I do this, AE sees the PSD as 'missing' and there seems to be no way to add a link to all layers for new PSD file name?  I have to click on each individual layer and replace one by one.

    Any ideas?

    See you soon

    Nope. It's just how it works. AE has no way to know about this either on changes to your PSD files, since the structure of PSD files is not persistent - a simple reorganization of the layers can make a mess. Where EI is able to reference absolute paths with all the disadvantages.

    Mylenium

  • Script to renumber the links in random order

    I have Chapter 1 page with 50 small photos in a very Orthodox and symmetrical grid should I repeat in a different random order for other chapters.

    Links have a logical syntax numbered like:

    pict1. TIF

    PICT2. TIF

    etc.

    For Chapter 2, the idea is to repeat the first but in a random order. Same photos, same layout, different order.

    Perhaps a script could rename the links?

    Thus, once the folder is duplicated, I'll have a second folder:

    Photo 1. TIF is now, for example, pict45.tif

    Picture2.tif.is now, for example, pict13.tif

    etc.

    IF I recreate a link to a copy of Chapter 1 of this second issue perhaps the idea could be resolved.

    Jarek, salvation.

    It works when it's only ONE image per page.

    But, with lots of photos on the page, as in the example, the script is dead.

    (no error at all)

    I have six pages with the same grid of images repeated in a file.

    The idea is that, at 2, 3, etc., the script changes the order randomly have different positions.

    I have tried various combinations but were useless.

    Thank you.

    PD. The screenshots show the script works with simple images.

  • Script to remove the first few characters of a PDF file name?

    I know it should be easy, but I'm not a coder and don't have many opportunities to write scripts.  I hope it's like a second request two anyone out there.  All I want to do is point a script in a PDF file that will review the file name, cut the first two characters of the file name and save the original file again.  I need to do this about 400 PDF documents on a recurring basis, hence the need for a script.  Thus, for example, if I have a C:/temp/myFile.pdf file, I would the script to rename the file to just "file.pdf".

    Any help would be greatly appreciated.

    JBF

    Use this code in your action (note that this will not work if your file name)

    contains the comma):

    var filePath = this.path.replace(this.documentFileName,"");

    var NouveauNomFichier = this.documentFileName.substring (2);

    this.saveAs (filePath + newFileName);

  • Script: rename the layers?

    Hi, is there a quick way to renumber or rename the lot all the layers in a file so that they would be called the number? Doesn't have to be from the exact number, I was wondering if maybe there's some kind of script that could help me with this? Thank you Pavel

    #target illustrator

    var app.activeDocument = docRef;

    with (docRef) {}

    for (var i = 0; i)< layers.length;="" i++)="">

    layers [i] .name = layers.length - i;

    }

    }

Maybe you are looking for

  • HP ENVY laptop - 13-d022tu: laptop lags when it is plugged

    Laptop works fine when on battery, but when I plug it, the laptop of begins to lag, and my games have a constant 20-24 FPS. I have also noticed that when the laptop is connected to 80% or higher it don't hang out, however, when I plug it to 20% or mo

  • HP-P6-2133W graphic questions.

    Well first of all... It has an APU which is supposed to be able to use double graphics, right? If I were to add a video card, the GPU of the APU shouldn't continue to work alongside the video card? So, activate it using the tool of Vision from AMD? W

  • Display the restore disk utilities

    I fell really stupid to post this question (as I burned the disks using the "disk utility" for 10 years and more), but I can't understand what is wrong. I have an iMac end of 2014 running version 10.11.2. I opened a disc image I had created, and then

  • How I got my HP 5510 e-all-in-one scan a direct output on an Android Tablet

    How I got my HP 5510 printer e-all-in-one scan a direct output on an Android Tablet? My printer is connected to my wireless network. During the installation of the printer, I was able to identify my desktop or portable computers computers "scan to" a

  • Why my photos do not appear when I leave my computer unattended?

    When I work on my computer and keep unattened for another 10 minutes, or so when I get home my picasa site photographs appear.  This seems to happen if I have already used internet or not.  To cause the pictures to disappear, I turn off my computer (