Highlighted

activeDocument.saveAs issues

New Here ,
Aug 30, 2020

Copy link to clipboard

Copied

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);   
}
Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hi,

I get Error 24: file is not a function when I try to use the following

For this, use File (F is capital not small)

activeDocument.saveAs(File(filename), tiffSaveOptions, true, Extension.LOWERCASE);

Let us know if this works for you.

Topics

Actions and scripting, Problem or error

Views

52

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

activeDocument.saveAs issues

New Here ,
Aug 30, 2020

Copy link to clipboard

Copied

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);   
}
Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hi,

I get Error 24: file is not a function when I try to use the following

For this, use File (F is capital not small)

activeDocument.saveAs(File(filename), tiffSaveOptions, true, Extension.LOWERCASE);

Let us know if this works for you.

Topics

Actions and scripting, Problem or error

Views

53

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
Aug 30, 2020 0
Adobe Community Professional ,
Aug 30, 2020

Copy link to clipboard

Copied

Hi,

I get Error 24: file is not a function when I try to use the following

For this, use File (F is capital not small)

activeDocument.saveAs(File(filename), tiffSaveOptions, true, Extension.LOWERCASE);

Let us know if this works for you.

Best regards

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
Reply
Loading...
Aug 30, 2020 0
New Here ,
Aug 30, 2020

Copy link to clipboard

Copied

I think I tried it, but it didnt wotk and I didnt to make a new filename = new File(otherfilename); to get it to work.

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
Reply
Loading...
Aug 30, 2020 0
Adobe Community Professional ,
Aug 30, 2020

Copy link to clipboard

Copied

Hi,

The above answer is same as filename = new File(otherfilename);

You can use any of the way. Just make sure F should be in uppercase for file.

Best regards

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
Reply
Loading...
Aug 30, 2020 0