saveAs() opens the manual 'Save As' window, instead of using given arguments
My script doesn't saveAs() on its own; whenever saveAs() is called, it opens the regular Save As window as if I had simply pressed Cmd+Shift+S. The default save name is the original file name, rather than the name in the File I pass in. After this the Quality window also comes up, defaulting to the last used value.
Other answers don't indicate that there would be an issue with this. My code is based on this: Automate Batch Script - Convert filenames to text in Photoshop
How do I get it to use the arguments I pass into saveAs()without opening the regular window instead?
var sourceFolder = Folder.selectDialog( "Select source folder" );
var destFolder = Folder.selectDialog( "Select destination folder" );
var sourceFiles = sourceFolder.getFiles();
var saveOptions = new JPEGSaveOptions();
saveOptions.quality = 12;
for( var i = 0; i < sourceFiles.length ; ++i )
{
var doc = app.activeDocument = app.open( sourceFiles );
desktopize();
var saveFile = new File( destFolder.absoluteURI + "/" + doc.name );
doc.saveAs( saveFile, saveOptions, false, Extension.LOWERCASE );
doc.close( SaveOptions.DONOTSAVECHANGES );
}
function desktopize()
{
...
}
