skip to Main Content

is it possible to copy the current active layer name in Photoshop and use it as the file name for a ‘Save As’ command in a Photoshop action?

Export Layers to Files isn’t suitable because I only want to save a single jpg at a particular point in the action, but because the action is recursive I need a way of changing the filename so that the resulting jpg isn’t overwritten with each recursion.

Many thanks!

2

Answers


  1. Have you tried : "Export layers to files..." in Files, Script ? You don’t tell us which method you are using right now.
    This should export each layer with their name + a custom prefix of your choice.

    Also, you may want to take a look at the Insert Menu Item that lets you record a set of actions and then does it automatically. If you need something more complex than the first option, this might be your solution.

    Login or Signup to reply.
  2. It’s possible to get the name of the activeLayer and save it within an variable:

    var layerName = app.activeDocument.activeLayer.name;
    var destFile = new File ("~/Desktop/" + layerName + ".jpg");
    

    If you want to document.saveAs() you should set the asCopy parameter to true:

    app.activeDocument.saveAs (destFile, docExportOptions, true, Extension.LOWERCASE);
    

    This will prevent a name change of the file you’re working with.

    Instead of document.saveAs() you could use document.exportDocument() in case you want a really small JPEG output.

    app.activeDocument.exportDocument (destFile, ExportType.SAVEFORWEB, docExportOptions);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search