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

Script for saving a PSD file in the same folder

Explorer ,
Jan 23, 2023 Jan 23, 2023

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

TOPICS
Actions and scripting
1.8K
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 1 Correct answer

Explorer , Jan 23, 2023 Jan 23, 2023

I solved it!

there should only be written "saveFile"

And not "saveFilePSD"

 

Cheers! 🙂

 

 

Translate
Adobe
Explorer ,
Jan 23, 2023 Jan 23, 2023
LATEST

I solved it!

there should only be written "saveFile"

And not "saveFilePSD"

 

Cheers! 🙂

 

 

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