Skip to main content
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);

 

This topic has been closed for replies.
Correct answer bradg24267645

Hi, thanks for the reply, we are making some progress! A new warning. See attached. An extra "/"?


I selected all and made plain text. And then I got this warning. The presents are spelled correctly so not sure what's happening there but still making progress! 

// 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+"_Trim.pdf"; 
d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1); 
d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);

1 reply

Community Expert
June 25, 2022

Hello

I'd save it as .jsx

To install the script - you need to locate the Scripts folder and insert the file there.

The file will then be available to run via the Window>Utilities>Scripts and locate the User folder within the panel.

 

https://creativepro.com/how-to-install-scripts-in-indesign/

 

Don't forget to modify the script as per the instructions.

Inspiring
June 25, 2022

Hi, thanks for the reply. The Window>Utilities>Scripts>User option was where I had attempted to install the script and was given the warning. Also, I forgot to mention that I had already edited the script for my PDF Presets (Slug and ToTrim). 

Community Expert
June 25, 2022

I see your file is called .jsx.txt

If you enable the view to see extensions of file formats https://support.apple.com/en-gb/guide/mac-help/mchlp2304/mac#:~:text=In%20the%20Finder%20on%20your,%E2%80%9CShow%20all%20filename%20extensions.%E2%80%9D

 

And remove the .txt from the filename

 

I think when you edited the .jsx - it save it as a .txt file

 

If you remove the .txt and just leave .jsx as the extension it should work.