activeDocument.saveAs issues
I am trying to save a tif file via script. The generated value for filename is /d/RAW%20Compare/teststack/Untitled-1_02_45_48.tif. The filename is generated, and the path was generated by using var folder = new Folder('D:/RAW Compare/teststack'); and adding filename to the end of it.
The Error I get is Error 1242: Illegal argument - argument 1
- File/Folder expected
function saveTiff(filename){
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.NONE;
activeDocument.saveAs(filename, tiffSaveOptions, true, Extension.LOWERCASE);
}
I get Error 24: file is not a function when I try to use the following
activeDocument.saveAs(file(filename), tiffSaveOptions, true, Extension.LOWERCASE);
edit:
Changing the function to the following helped make it work
function saveTiff(filename){
tiffFile = new File(filename);
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.NONE;
//alert(filename);
activeDocument.saveAs(tiffFile, tiffSaveOptions, true, Extension.LOWERCASE);
}