Skip to main content
Known Participant
June 30, 2024
Question

Indesign script

  • June 30, 2024
  • 2 replies
  • 241 views

Can I apply a script to multiple InDesign projects without waiting for the first one to finish and moving on to the second?"

This topic has been closed for replies.

2 replies

Robert at ID-Tasker
Legend
June 30, 2024
quote

Can I apply a script to multiple InDesign projects without waiting for the first one to finish and moving on to the second?"


By @aghanjar16430960

 

Not possible in JS. 

 

Or you need to invest in InDesign Server. 

 

Community Expert
June 30, 2024

What are you trying to do? 

Maybe something like this. 

var files = [
    "path/to/your/first/project.indd",
    "path/to/your/second/project.indd",
    // Add more file paths here
];

for (var i = 0; i < files.length; i++) {
    var file = new File(files[i]);
    if (file.exists) {
        var doc = app.open(file);
        // Your script logic here
        // For example, add a simple text frame
        var textFrame = doc.pages[0].textFrames.add();
        textFrame.geometricBounds = [72, 72, 144, 288];
        textFrame.contents = "Hello, InDesign!";
        
        // Save and close the document
        doc.save();
        doc.close();
    }
}