script to save as JPEG in photoshop not working!
Hi guys,
I am new at scripting for Photoshop.
I am using this code for saving as a JPEG but it isn't working:

What is wrong with my code? Please help!
Best regards,
Joseph
Hi guys,
I am new at scripting for Photoshop.
I am using this code for saving as a JPEG but it isn't working:

What is wrong with my code? Please help!
Best regards,
Joseph
You can use a relative path (to the logged-in user account ~) for the open step:
open(new File("~\\Downloads\\Adobe Scripting\\photoshop file test for saveAs.psd"));
Or ExtendScript cross-platform single forward slash directory separators in relative path, rather than escaped Windows OS double back slashes:
open(new File("~/Downloads/Adobe Scripting/photoshop file test for saveAs.psd"));
Try saving to a user folder such as the Desktop or Downloads rather than to the root system level. Also, even though a four letter JPEG extension is valid, Photoshop doesn't like them, so use a three letter JPG extension instead:
jpgFile = new File ("~/Desktop/Temp001.jpg");
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 1;
app.activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);


Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.