🦊Close All InDesign Files with One Click: A Script for Busy Designers

As a technical writer and InDesign user, I often find myself working with a large number of open InDesign files at the same time.
You might know the feeling—at the end of a busy day, you just want to close everything quickly and call it a day.

Of course, you can always use Ctrl+Q to quit InDesign entirely. But then, when you want to get back to work, you have to launch InDesign all over again, which can be a bit of a hassle, especially if you need to continue working right away.

That’s why I created this simple script. It allows you to close all open InDesign documents with a single click—but it leaves InDesign itself running, so you can stay in your workflow.

When I shared this script with my colleagues, it got some surprisingly positive feedback!
It’s a small, handy tool, so I’ve decided to make it available to everyone for free.


#target indesign


try {

    var docs = app.documents;

    for (var i = docs.length - 1; i >= 0; i--) {

        var doc = docs[i];

        if (doc.saved) {

            doc.close(SaveOptions.yes);

        } else {

            // Skip (do not close unsaved documents)

        }

    }

} catch (e) {

    alert(e);

}


var flag = confirm("Do you want to close all open Books as well?");


if (flag == true) {

    while (app.books.length > 0) {

        app.activeBook.close(SaveOptions.yes);

    }

}



How it works:
  • The script closes all open InDesign documents that have already been saved.

  • If there are any unsaved documents—such as newly created files or files right after format conversion—they will be skipped (left open) to prevent accidental data loss.
       Please be aware of this limitation!

After closing the documents, the script will also ask if you want to close any open Books. If you confirm, all open Books will be closed as well.


Tested Environment

This script was tested with the Windows versions of InDesign CC 2023 and 2024.
It should also work with other recent versions of InDesign, although I have not verified every version.
I have not tested it on Mac OS, but it should work there as well.


How to Use

  1. Download the script (see below).

  2. Place the file in your InDesign Scripts folder.

  3. Double-click the script in the Scripts Panel in InDesign to run it.


Download

Download the script here (closeAllDocsAndBooks_saved.jsx)


Final Note

I hope this little tool saves you some time! 

Popular Posts