user2804628
user2804628

Reputation: 143

Save document to different folder

below is my test directory structure:

enter image description here

I have made a script which works on a psd file in the finals folder. My aim is to save it to the tifs folder. This is the code i have:

app.activeDocument.saveAs(file."../tifs", TiffSaveOptions, true, Extension.LOWERCASE);

I am well and truly stuck. I have tried so many combinations and everything is throwing an error. I just want to come out of the finals folder, and then go into the tifs folder and save.

any help would be much appreciated. :)

Upvotes: 1

Views: 2376

Answers (1)

Ghoul Fool
Ghoul Fool

Reputation: 6949

You've not set up your file path correctly. I suspect "../tifs" isn't working as you'd hoped. Here it is in full.

// Flatten the tiff
app.activeDocument.flatten();

// set up the new directory
// make sure you change this or
// have a folder in c:\testpsd\tifs
var myFolder = "c:\\testpsd\\tifs"; // add extra escape slash

// get the documents name
var myFileName = app.activeDocument.name;

// remove it's extension
var myDocName = myFileName.substring(0,myFileName.length -4);

// set the new filename and path
var myFilePath = myFolder + "/" + myDocName + ".tiff";

// tiff file options
var tiffFile = new File(myFilePath);
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.byteOrder = ByteOrder.MACOS;
tiffSaveOptions.layers = false;
tiffSaveOptions.transparency = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.embedColorProfile = false;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
tiffSaveOptions.saveImagePyramid = false; 

// finally save out the document 
activeDocument.saveAs(tiffFile, tiffSaveOptions, false, Extension.LOWERCASE);

Upvotes: 1

Related Questions