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

Script for saving a PSD file in the same folder

Explorer ,
Jan 23, 2023 Jan 23, 2023

Copy link to clipboard

Copied

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

Views

109

Likes

Translate

Translate

Report

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! 🙂

 

 

Likes

Translate

Translate
Explorer ,
Jan 23, 2023 Jan 23, 2023

Copy link to clipboard

Copied

LATEST

I solved it!

there should only be written "saveFile"

And not "saveFilePSD"

 

Cheers! 🙂

 

 

Likes

Translate

Translate

Report

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