Copy link to clipboard
Copied
Although the following script worked previous, it appears to fail now with a disk error (-43).
Anyone else see this? Any fixes or workarounds?
Ok, I found your issue. you are defining your file path with the file name in it. Try this:
// Define the file path where you want to save the file
var filePath = new Folder("~/Desktop/");
// Create a new File object with the file path
var jpgFile = new File(filePath + '/jpgFile.jpg');
// Define the JPEG save options
var jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = Ma
...
Copy link to clipboard
Copied
I am a Mac-user myself, but as the Script seems otherwise fine I suspect there might be an issue with the Path.
Did you replace »<myusername>« with your username?
Does a File of that name and location already exist?
Is enough space available?
Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Options Bar, …) visible?
Copy link to clipboard
Copied
I would change the line declaring the file path to using the "~". This will make it so that that line works on Win and Mac, and any user that uses that computer.
var filePath = "/~/Desktop/file.jpg";
Copy link to clipboard
Copied
Ok, I found your issue. you are defining your file path with the file name in it. Try this:
// Define the file path where you want to save the file
var filePath = new Folder("~/Desktop/");
// Create a new File object with the file path
var jpgFile = new File(filePath + '/jpgFile.jpg');
// Define the JPEG save options
var jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 12;
// Save the active document with the defined file and JPEG save options
app.activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);