Inspiring
June 24, 2022
Answered
Export multiple PDF presents for Mac Studio with JS
- June 24, 2022
- 1 reply
- 1472 views
Hi, I am running InDesign 17.3 on a Mas Studio and trying to use the inserted script below (also attached) that I found here (https://www.id-extras.com/script-to-export-multiple-pdfs-at-once/) but when I try to add it to InDesign I get a warning saying "This file is not executable by any supported script language." I copied the script from the link above above and pasted into a new TextEdit document and saved it using both .jsx and .jsxbin extensions. I got the warning for both. Is this a silicon chip issue? Is there a solve? I know nothing about scripting. Thank you!
// BS"D
// All rights reserved (c) 2015 by Id-Extras.com
// Free to use and modify but do not delete this copyright attribution.
// This script will export 2 pdfs of the current document
// Choose the PDF presets by altering their names below
// The second PDF gets a suffix added to its name.
// Modify the line below beginning name2 = to change the suffix.
// For more InDesign scripts: www.Id-Extras.com
d = app.activeDocument;
// Here you can choose the PDF preset
preset1 = app.pdfExportPresets.itemByName("[PDFX1a Slug]");
preset2 = app.pdfExportPresets.itemByName("[PDFX1a Trim]");
if (!(preset1.isValid && preset2.isValid)){
alert("One of the presets does not exist. Please check spelling carefully.");
exit();
}
if (d.saved){
thePath = String(d.fullName).replace(/\..+$/, "") + ".pdf";
thePath = String(new File(thePath).saveDlg());
}
else{
thePath = String((new File).saveDlg());
}
thePath = thePath.replace(/\.pdf$/, "");
name1 = thePath+".pdf";
// Here you can set the suffix at the end of the name
name2 = thePath+”_ToTrim.pdf";
d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1);
d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);
