Copy link to clipboard
Copied
I´m trying to use a script exporting smart layers in batch. Always get an error about this line:
"activeDocument.saveAs(File(saveFile+".jpg"), jpgSaveOptions, true,Extension.LOWERCASE);"
function SaveAsJPEG(saveFile, jpegQuality){
var doc = activeDocument;
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(File(saveFile+".jpg"), jpgSaveOptions, true,Extension.LOWERCASE);
}
Error: General Photoshop error. The feature may not be available in this version of Photoshop.
no further information is available
I have no clue why. Does this relate to the new save as copy thing?
Any ideas on how to solve this?
thank you 🙂
Copy link to clipboard
Copied
try this
if (documents.length) {
Desktop = File(Folder.desktop + "/layername");
SaveAsJPEG(Desktop);
}
function SaveAsJPEG(saveFile, jpegQuality){
var doc = activeDocument;
if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) doc.bitsPerChannel = BitsPerChannelType.EIGHT;
if (jpegQuality == undefined ) jpegQuality=10;
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(File(saveFile+".jpg"), jpgSaveOptions, true,Extension.LOWERCASE);
}
Copy link to clipboard
Copied
Hi JJMack,
many thanks for the quick reply.
I'm actually using one of your scripts 🙂 thank you for uploading them!
PhotoCollageToolkit - BatchreplaceOneObject
Free Photoshop Photo Collage and Mockup Toolkit
I can´t get the code to work. I´ve replaced the patch of code with your new one, but it´s doesn't do the trick.
I don`t have any knowledge about javascript so it´s likely my mistake placing it wrong. For good measure, it`s line 547 (in the original script) that is causing the error.
What I´m trying to do, is to automatically switch out one smart object with hundreds of different images that are cropped perfectly to the size of the smart object's image size and save each version as jpg.
Copy link to clipboard
Copied
Are you sure you pass a file object? The first parameter "saveFile" need to be a file object you can not just pass a layer name to be used a file name.
In my scrupt you saw
outputFile = outputFolder + "/" + theNewName +" " + templateName ; // Construct full output file path
SaveAsJPEG( outputFile , 10 );
You may have missed the fact that "outputFolder " is a folder object.
// Gets the output folder from the UI
var outputFolder = BOCollage.msgPn3.etDestination.text;
//alert(outputFolder);
var outputFolder = new Folder(outputFolder);
Copy link to clipboard
Copied
SaveAsJPEG(Folder.desktop + '/someName', 12)
Copy link to clipboard
Copied
Try This For Batch
var theDocs = app.documents;
var inputFolder = Folder.selectDialog("Select Your Destination Path");
var savepath= decodeURI(inputFolder.fsName);
for (var m = 0; m < theDocs.length; m++) {
var theDoc = theDocs[m];
app.activeDocument = theDoc;
var saveFile = new File(savepath + "/" + "Name"+".jpg");
SaveJPEG(saveFile,12);}
function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
}
Copy link to clipboard
Copied
...
del