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.

Similar Messages

  • Re Trim file name scripts in SL

    Below is a frozen, unanswered conversation regarding the missing finder scripts in SL. Luckily, I make a complete backup before converting, so I still have all the old Leopard scripts. Norwichfan, I feel your pain, and I thought that archiving your thread without an adequate answer was wrong.
    Here's your answer. you can just get a copy of the old finder scripts, put them in /Library/Scripts and they'll show up in your script menu as before. I have zipped up a copy of them and posted them here:
    http://tedward.org/finder_scripts.zip
    norwichfan88
    Posts: 12
    From: Australia
    Registered: Mar 25, 2010
    Trim file name scripts in SL
    Posted: Mar 26, 2010 6:26 PM
    I have recently upgraded to SL and have found that the trim/add to file name applescripts from leopard are missing from my scripts menu.
    Is there a place I can find these for SL?
    MBP mid-2009 Mac OS X (10.6.2)
    Pierre L.
    Posts: 824
    From: Québec
    Registered: Jan 26, 2009
    Re: Trim file name scripts in SL
    Posted: Mar 26, 2010 6:49 PM in response to: norwichfan88
    Solved
    Maybe something similar in this web page?
    15-inch MacBook Pro 2.53 GHz Mac OS X (10.6.2) AirPort Extreme
    norwichfan88
    Posts: 12
    From: Australia
    Registered: Mar 25, 2010
    Re: Trim file name scripts in SL
    Posted: Apr 10, 2010 12:03 AM in response to: Pierre L.
    Thanks for the web page, had a look but not having done any work with applescript or other programming language was a bit over my head.
    I decided to make a temporary solution with and automator action.
    MBP mid-2009 Mac OS X (10.6.2)

    Thanks for the web page, had a look but not having done any work with applescript or other programming language was a bit over my head.
    I decided to make a temporary solution with and automator action.

  • I am using CS6. When exporting layers to files in Scripts, I get an error message Error 519: Server

    I am using CS6. When exporting layers to files in Scripts, I get an error message Error 519: Server Interface error. 'No component returned from CreateWidget'

    Hi. You’ve posted your question in a forum that is for beginners trying to learn the basics of Photoshop.  I'm moving your question to the Photoshop General Discussion forum for specialized attention to your situation.

  • How to alter 'add to file names' script?

    I'm working on some stuff that I need to get done today, and it dawned on me that I could save a lot of time if I had a certain script perform a simple task for me. Unfortunately I haven't been able to get one to work right. I just want to be able to add the same thing onto the end of a file name... For instance, 01.jpg would become 01x.jpg, 02.jpg becomes 02x.jpg and so on. The basic 'Add to File Names' script will almost work, but it adds to the front of the name, not the back. Does anyone know how I could alter the lines in that script to get it to do what I want?
    Thanks for any help,
    Dave

    01. Under 'Alternative 01:', the line ...
    No error checking for folders is included. Such is an exercise for the student.
    ... should have been ...
    --No error checking for folders is included. Such is an exercise for the student.
    02. The error message ...
    "System Events got an Error: NSCannotCreateScriptCommandError".
    Hmmm, those replying are using MacOS X 10.4.x, and you are using MacOS X 10.2.x. Others, with Macs running MacOS X 10.2.x and using AppleScript code from MacOS X 10.3.x and later, do at times experience 'NSCannotCreateScriptCommandError' error messages.
    In the code below, 'System Events' was replaced with 'Finder'. Some additional editing was performed, where required.
    Alternative 01:
    property tAddition : "x" -- The charcter or string to append to the files' name.
    tell application "Finder"
    set tSelection to selection
    --No error checking for folders is included. Such is an exercise for the student.
    repeat with i in tSelection -- Cycle through the provided files.
    set {displayed_name, name_Extension} to {displayed name of (i as alias), name extension of (i as alias)}
    if ((displayed_name ends with name_Extension) and ((count name_Extension) > 0)) then
    -- Handle file names which include a name extension.
    set (name of i) to ((get (characters 1 through ((count displayed_name) - (count name_Extension) - 1) of displayed_name) as string) & tAddition & "." & name_Extension)
    else
    set (name of i) to (displayed_name & tAddition) -- Handle file names without a name extension.
    end if
    end repeat
    end tell
    Save the AppleScript code as a script.
    Move file (or a copy or alias of the file) to the '~/Library/Scripts/' folder.
    Select files to be processed, in 'Finder'.
    Select the script, via the 'Script menu'.
    Alternative 02:
    property tAddition : "x" -- The charcter or string to append to the files' name.
    on run {} -- User double-click on the applet.
    display dialog "Drag file(s) onto applet for processing."
    end run
    on open selected_Items -- User dragged items onto applet.
    my handleitems(selectedItems) -- Processed items dragged onto applet.
    end open
    on handleitems(localItems)
    -- No error checking for folders is included. Such is an exercise for the student.
    tell application "Finder"
    repeat with i in local_Items -- Cycle through the provided files.
    set {displayed_name, name_Extension} to {displayed name of i, name extension of i}
    if ((displayed_name ends with name_Extension) and ((count name_Extension) > 0)) then
    -- Handle file names which include a name extension.
    set (name of i) to ((get (characters 1 through ((count displayed_name) - (count name_Extension) - 1) of displayed_name) as string) & tAddition & "." & name_Extension)
    else
    set (name of i) to (displayed_name & tAddition) -- Handle file names without a name extension.
    end if
    end repeat
    end tell
    end handle_items
    Save the AppleScript code as an applet (application).
    Drag files to be processed, onto the applet, in 'Finder'.

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

  • Obscure file name script advice

    I have a CD full of images created on OS/X with file names like
    R 519 (S 64).jpg
    I have a list of these file names and the names to which I need to change.
    In a sh srcipt I tried all of these variations
    mv 'R 519 (S 64).jpg' x
    mv "R 519 (S 64).jpg" x
    mv "R\ 519\ \(S 64\).jpg" x
    The files show normally in Finder but there is thousands of them and I would like to do it in batch.
    Could you please suggest a workable solution?

    This thread is very difficult to follow (I'm not a native English speaker).
    First of all, is the problem "Solved"? It seems your "problem" has changed a few times. Exactly what is you problem?
    I have a CD full of ....
    You can't rename files on CD (it's read only). I assume you have copied them to your hard drive.
    mv 'R 519 (S 64).jpg' x
    mv "R 519 (S 64).jpg" x
    mv "R 519 (S 64).jpg" x
    None of them works.
    Very strange. As Mark writes, the first one (single quote) should work. The second one (double quote) should also work. What kind of error do you get?
    the issue is renaming files whose names are in a text source file to arbitrary names in the same source file, like in:
    oldname1 newnameI
    som other name yet another new name
    Is this your (current) problem?
    If both oldname and newname contain spaces, then it is obviously impossible to figure out where oldname ends and newname starts. If it is guaranteed that *the newname does not contain any space*, then your task can be easily done by a simple shell script, for example
    #!/bin/sh
    while read -a line
    do
    n=${#line[*]} # number of words on this line
    oldname="${line[*]: 0: $n - 1}"
    newname="${line[$n - 1]}"
    echo 'rename "'$oldname'" to "'$newname'"'
    # mv "$oldname" "$newname"
    done < thelist
    Here "thelist" is the name of the file containing the list of "oldname newname" pair (a pair in each line). The "mv" command is commented out since it is rather dangerous. If you are satisfied with the output of echo, then uncomment the mv command.
    If I correctly understood (or guessed) your problem, then this should solve it. But you write
    The problem is in matching the names in left column with the names in OS/X file system
    What do you mean by "matching the names"? You also write
    I solved now as a bypass by obtaining the "real" file name through find, ...
    What do you mean by "real file name"? You mean "R 519 (S 64).jpg" is not a real name? I feel I'm still missing your "real" problem.

  • Add file name script not working in CS3

    I have this wonderful script (written by Brian Price) back in 2004 for PS7 that adds the file name to an image ( I use it for adding file names to small images to be used in a slideshow). It works great ion Photoshop CS, but when I try to use it as part of a batch action in CS3 it stalls on line 9. OIt works fine when run on just one image in CS3 . . . it just stalls when run as part of a batch action!
    Any help GREATLY appreciated!
    Many Thanks,
    Peter Thompson
    [email protected]
    www.photohawaii.com
    Here's the script:
    // this script is a variation of the script addTimeStamp.js that is installed with PS7
    //Copyright 2002-2003. Adobe Systems, Incorporated. All rights reserved.
    //All amendments Copyright Brian Price 2004 ([email protected])
    //Check if a document is open
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PERCENT;
    try
    var docRef = activeDocument;
    // Create a text layer at the front
    var myLayerRef = docRef.artLayers.add();
    myLayerRef.kind = LayerKind.TEXT;
    myLayerRef.name = "Filename";
    var myTextRef = myLayerRef.textItem;
    //Set your parameters below this line
    //If you wish to show the file extension, change the n to y in the line below, if not use n.
    var ShowExtension = "n";
    // Insert any text to appear before the filename, such as your name and copyright info between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextBefore = "";
    // Insert any text to appear after the filename between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextAfter = "";
    // Set font size in Points
    myTextRef.size = 30;
    //Set font - use GetFontName.js to get exact name
    myTextRef.font = "ComicSansMS";
    //Set text colour in RGB values
    var newColor = new SolidColor();
    newColor.rgb.red = 255;
    newColor.rgb.green = 255;
    newColor.rgb.blue = 0;
    myTextRef.color = newColor;
    // Set the position of the text - percentages from left first, then from top.
    myTextRef.position = new Array( 5, 94);
    // Set the Blend Mode of the Text Layer. The name must be in CAPITALS - ie change NORMAL to DIFFERENCE.
    myLayerRef.blendMode = BlendMode.NORMAL;
    // select opacity in percentage
    myLayerRef.opacity = 100;
    // The following code strips the extension and writes tha text layer. fname = file name only
    di=(docRef.name).indexOf(".");
    fname = (docRef.name).substr(0, di);
    //use extension if set
    if ( ShowExtension == "y" )
    fname = docRef.name
    myTextRef.contents = TextBefore + " " + fname + " " + TextAfter;
    catch( e )
    // An error occurred. Restore ruler units, then propagate the error back
    // to the user
    preferences.rulerUnits = originalRulerUnits;
    throw e;
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    else
    alert( "You must have a document open to add the filename!" );

    I have this wonderful script (written by Brian Price) back in 2004 for PS7 that adds the file name to an image ( I use it for adding file names to small images to be used in a slideshow). It works great ion Photoshop CS, but when I try to use it as part of a batch action in CS3 it stalls on line 9. OIt works fine when run on just one image in CS3 . . . it just stalls when run as part of a batch action!
    Any help GREATLY appreciated!
    Many Thanks,
    Peter Thompson
    [email protected]
    www.photohawaii.com
    Here's the script:
    // this script is a variation of the script addTimeStamp.js that is installed with PS7
    //Copyright 2002-2003. Adobe Systems, Incorporated. All rights reserved.
    //All amendments Copyright Brian Price 2004 ([email protected])
    //Check if a document is open
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PERCENT;
    try
    var docRef = activeDocument;
    // Create a text layer at the front
    var myLayerRef = docRef.artLayers.add();
    myLayerRef.kind = LayerKind.TEXT;
    myLayerRef.name = "Filename";
    var myTextRef = myLayerRef.textItem;
    //Set your parameters below this line
    //If you wish to show the file extension, change the n to y in the line below, if not use n.
    var ShowExtension = "n";
    // Insert any text to appear before the filename, such as your name and copyright info between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextBefore = "";
    // Insert any text to appear after the filename between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextAfter = "";
    // Set font size in Points
    myTextRef.size = 30;
    //Set font - use GetFontName.js to get exact name
    myTextRef.font = "ComicSansMS";
    //Set text colour in RGB values
    var newColor = new SolidColor();
    newColor.rgb.red = 255;
    newColor.rgb.green = 255;
    newColor.rgb.blue = 0;
    myTextRef.color = newColor;
    // Set the position of the text - percentages from left first, then from top.
    myTextRef.position = new Array( 5, 94);
    // Set the Blend Mode of the Text Layer. The name must be in CAPITALS - ie change NORMAL to DIFFERENCE.
    myLayerRef.blendMode = BlendMode.NORMAL;
    // select opacity in percentage
    myLayerRef.opacity = 100;
    // The following code strips the extension and writes tha text layer. fname = file name only
    di=(docRef.name).indexOf(".");
    fname = (docRef.name).substr(0, di);
    //use extension if set
    if ( ShowExtension == "y" )
    fname = docRef.name
    myTextRef.contents = TextBefore + " " + fname + " " + TextAfter;
    catch( e )
    // An error occurred. Restore ruler units, then propagate the error back
    // to the user
    preferences.rulerUnits = originalRulerUnits;
    throw e;
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    else
    alert( "You must have a document open to add the filename!" );

  • Add file name script

    I have a script for adding the file name as a text layer in PS. This script called "AddFileName02.js" worked by placing the file in the scripts folder on the hard drive. This script worked for PS CS2 (and I think PS CS3). This script could then be accessed by <file><automate><scripts>
    Now that I have PS CS5 I have tried to place this script into the same place in PS CS5, but it does not appear. (I restarted PS) As I see it there could be two possible problems.
    1 The script has a .js extension and all other scripts in PS CS5 have a .jsx extention. So a newer version may be needed.
    2 I have placed the script in the wrong folder.
    Can anyone help?

    Just rename ist with the jsx-suffix and place it in the Presets > Scripts-folder.
    If that does not work you could try the Photoshop Scripting Forum, though some of the regulars also do drop by in this Forum.

  • Batch Convert PowerPoint to Movies file name issue

    I need to batch convert powerpoint presentations to movie. But the save option forces me to use the same name on every movie. I want it to just save the presentation with the same file name. So if the powerpoint is:
    MyPresentation.ppt
    then the movie should be
    MyPresentation.mov
    How can I do this?
    Here is a screenshot of the workflow.

    Okay, so I tried ditching automator and doing the convert movie parts via applescript. This is what I tried but it gives me an automator error -212 (apparently on the first "perform action") saying "expected end of line, found property":
    Any ideas on how to get the script to work with autmator (I tested a modified version of this script outside autmator and it does work for a single file).
    on run {input, parameters}
      -- Use the "Make Movie..." command in PowerPoint to make a QuickTime movie
              tell application "System Events"
                        tell application "Microsoft PowerPoint"
      launch
      open input
                                  set frontmost to true
                                  set theNameOfPresentation to title of last window
      -- Click on the Save as Movie... command in the File menu
                                  perform action "AXPress" of menu item "Save as Movie..." of menu 1 of menu bar item "File" of menu bar 1
                                  repeat until ((exists of sheet 1 of window theNameOfPresentation) is true)
                                  end repeat
      -- Enter the name of the Presentation
                                  set value of text field 1 of sheet 1 of window theNameOfPresentation to theNameOfPresentation & ".mov"
                                  delay 2
      -- Click on the Save button
                                  perform action "AXPress" of button "Save" of sheet 1 of window theNameOfPresentation
                                  delay 2
      close input
                        end tell
              end tell
              return input
    end run

  • Bulk File Rename - based on another files name.

    Hi Scripting Guys,
    I'm sure you have dealt with questions like this before, but I haven't found a solution that will do what I want.  I have a group of driver folders that I have backed up.  Each one of these folders contains at least a .cat file and a .inf file. 
    Unfortunately, all the .inf files are named oemxx.inf where xx is a different random number in each folder.  I would like to be able to rename all the .inf files to match the name of their corresponding .cat file.  This seems as if it should be easy,
    but I am struggling to find an answer.
    Love your work and thanks in advance.

    I have created this PS script to do the job. I use Double Driver to back up various machines and didn't want multiple oem.inf files with the same name in my backup store. Feel free to use it.
    # Powershell script to rename all the oem.inf files
    # and delete the restore.ini file in each directory
    # Set the $root variable to the top level path of the drivers
    # Created 27th February 2015 by Mike McAnulty
    Clear-Host
    $root = "H:\Drivers"
    $dirList = Get-ChildItem -Path $root -Recurse | Where {$_.extension -eq  ".inf"}
    Write-Host "Processing... "$root -foregroundcolor "yellow"
    Write-Host
    Write-Host -foregroundcolor "white"
    foreach ($file in $dirList)
     $catFile = Get-ChildItem -Path $file.Directory | Where {$_.extension -eq  ".cat"}
     Write-Host "Processing... "$catFile.BaseName -nonewline
     Rename-Item $file.FullName ($catFile.BaseName + ".inf") -ErrorAction SilentlyContinue
     Write-Host `t"Done...."
     Remove-Item ($file.DirectoryName + "\restore.ini") -ErrorAction SilentlyContinue
    Set-Location $root

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

  • Adding batch serial number to report file name in sequential model

    Hi,
    I'm using a Sequential model in TS 4.0 and have learned how to add the UUT serial number to the report file name. But I would like to add the batch serial number instead. Is this possible? Any modifications to the ReportOptions callback seem to only modify the temp report name.
    Thanks!
    Chris

    Hi Chris,
    While Paul's suggestion may be useful in this case, if you would like the flexibility of customizing your Report File Pathnames further, you may want to consider upgrading to TestStand 4.2.
    In TestStand 4.2 we introduced predefined macros and the ability to use custom expressions to specify the Report File Pathname. For example, the <Batch> macro will add the Batch Serial Number to the Report File Pathname as you specify it.
    Please see the Using Expressions to Customize Report File Paths section of the TestStand 4.2 Reference Manual for more information on these new reporting features and how one might use them. For a specific explanation of the different macros and what they might be used for, please see the Specifying Report File Paths by Expression section of the TestStand 4.2 Online Help.
    Manooch H.
    National Instruments

  • Rename PDF retains original file name?

    I'm doing a forensic analysis of a PDF file sent from a multi-function printer. The PDF was renamed in Windows by the user but I need to determine the original PDF name as it was sent from the printer. I have used a PDF parsing tool to try and determine if the original file name is stored somewhere in the PDF itself but no joy. Any metadata I can see from simply opening the document in Acrobat Reader shows the printer model that created the PDF but not the original filename. Anyone know if this historical filename data is available to me or I've lost it ?
    Thanks.

    By doing a simple save as a user can create a completely new document so your forensis isn't going to get far.  Just out of interest what are you trying to prove?  Someone may be able to suggest another way around it...

  • How to automatically rename tracks according to file name

    Hi all,
    this is probabaly a very simple fix but for some reason its foxing me today,
    in CS6 when importing multiple audio files, is there a way of automatically naming the tracks the same as the file name.
    eg if the file is labeled 'snare.wav' and you import it into Track 1, then the track is then renamed 'snare'
    thanks.

    Thanks for the reply Steve, I understand the implications your refering to, I just wondered if there was an option to turn this on if required, so for instance if i am importing 70 or so audio files i dont have to go through and name each track one by one.
    something similar to the 'Use Audio File Name as Track Name' option in Logic would be useful.
    regards

Maybe you are looking for

  • Objects behind keyboard

    I been having Pproblems while in the text screen if a notification or the undo typing box appears its shows behind the keyboard to where I can neither allow nor cancel the action. I been having to press the lock button then unlocking the screen and r

  • How to improve the performance in AM level

    Hi, I am using Jdeveloper 11.1.1.2.0 and weblogic server 10.3.2. How to improve the performance in AM level. Actually i have approx 10 lacs Data but when search the record then it is taking more time. I have following the link.. http://www.gebs.ro/bl

  • Theme of company code & businesss area

    Dear Friends,        I want to know what are the merit & demerit of one company code having  four plant & for each plant having indivisual company code & what are the advantageses of business area points must be rewarded . Thanks      Amin

  • BPF Questions

    Hello All, I have a BPF Instance with 2011.TOTAL, PLN with driver dimension to be Cost center. I have 3 steps in my BPF. I have different values for my drive dimension in creating the BPF Instance. If a Planner is done with all 3 steps, it does not l

  • SAPScript to PDF in Webdynpro for Java

    Hi All, I have to display Form16 for an employee in pdf format in portal. Form16 is available as SAPscript. ECC 6.0 Report Program:HINCF160 We can run transaction 'HRESSIN_F16' in se93 to see Form16, How can we get the same to Webdynpro, If we use an