Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Save psd file with the selected layers name script help

Explorer ,
Jul 24, 2021 Jul 24, 2021

If I have a photoshop file open with several layers(for example Layer 0, Layer 1, Layer 2 as their layer names) I would like to manually select Layer 2 selected and run the script to take that name and save my file with that name, Layer2.psd

 

Thanks

TOPICS
Actions and scripting , macOS
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

LEGEND , Jul 25, 2021 Jul 25, 2021
with(activeDocument) saveAs(File(path + '/' + activeLayer.name))
Translate
LEGEND , Jul 27, 2021 Jul 27, 2021

 

with(activeDocument) saveAs(File('~/desktop/' + activeLayer.name.slice(0, 8)))

 

Translate
Adobe
LEGEND ,
Jul 25, 2021 Jul 25, 2021
with(activeDocument) saveAs(File(path + '/' + activeLayer.name))
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 27, 2021 Jul 27, 2021

I have a bunch of images in Bridge and I select a few that I want layered in Photoshop so I choose Tools>Photoshop>Load into Photoshop Layers

So then I wrote this,

function flattenSaveWithLayerName() {
  with(activeDocument) saveAs(File(path + '/' + activeLayer.name))
}
flattenSaveWithLayerName();
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

Which I want to save my file into a new file (also into another subfolder, But I'll take what I can get) with a specific layers name(another thing I would prefer the new file to only consist of the first 8 letters/numbers from the layer name, again I'll take what I can get) 

I get dialog "Error 8103: The document has not yet been saved."

 

When I run this script on a a multi-layer file that I create by dragging one file onto another it works. Those layers are Background and Layer 1.  But I need it to work when the layers are placed with their filename.

 

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 27, 2021 Jul 27, 2021

 

with(activeDocument) saveAs(File('~/desktop/' + activeLayer.name.slice(0, 8)))

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 28, 2021 Jul 28, 2021
LATEST

Wow, Thanks,  That does so much with so little.  And I have learned alot from it.  I named the script file kukurykus.jsx.  I'm trying to figure out how to save it to a specific folder on a remote drive, but that looks not possible due to location of the working files not really having a home.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines