Skip to main content
Inspiring
January 23, 2023
Answered

Script for saving a PSD file in the same folder

  • January 23, 2023
  • 1 reply
  • 1742 views

Hello Hello,

 

I want to have a script to save a .PSD file in the same folder as my working file (.PSB).

I am a newbie and tried got so far; but Photoshop tells me "Fehler 2: saveFilePSD ist undefiniert."

In English something like "Error 2: saveFilePSD is undefined.

 

my Script:

 

#target photoshop
app.bringToFront();
var folderPath = app.activeDocument.path;


var fileName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var fileType = ".psd";
var saveFile='';

saveFile=File(folderPath + '/' + fileName + fileType);
SavePSD(saveFilePSD);

function SavePSD(saveFilePSD) {
psdSaveOptions = new PhotoshopSaveOptions();
psdSaveOptions.embedColorProfile = true;
psdSaveOptions.alphaChannels = true;
psdSaveOptions.layers = true;
psdSaveOptions.annotations = true;
psdSaveOptions.spotColors = true;
app.activeDocument.saveAs(saveFilePSD, psdSaveOptions, true, Extension.LOWERCASE);
};

 

Script end

 

If somebody can help me and solve the problem, I would be very happy!

Thank you very much,

all the best

Florian

This topic has been closed for replies.
Correct answer Fat Croissant

I solved it!

there should only be written "saveFile"

And not "saveFilePSD"

 

Cheers! 🙂

 

 

1 reply

Fat CroissantAuthorCorrect answer
Inspiring
January 23, 2023

I solved it!

there should only be written "saveFile"

And not "saveFilePSD"

 

Cheers! 🙂