Skip to main content
Participant
February 11, 2025
Answered

When I open the index Chapter in a Book, Indesign opens all the other chapters

  • February 11, 2025
  • 2 replies
  • 320 views

I have an Indesign book consisting of several chapters (about 500 pages in total). One of these chapters is the index, a normal document in which I have created interactive buttons that open the other chapters (in the exported interactive Adobe PDF).

The problem only occurs when I open the index chapter, and when I do, all the other chapters open at the same time, sometimes directly in the upper document bar, sometimes in background (I know because a dot appears next to the documents in the Books tab). I then usually try to close all the other documents except the index, but when I click on a button and then open the Buttons/Modules tab, the document linked to the button opens again.

Now, how can I avoid this problem? This is very annoying as my PC freezes and takes forever to open all the documents.

 

I'm currently using version 20.0.1 x64 on a Windows 11 OS.

Correct answer Eugene Tyson

Found a similar topic and modified the script (I think) 

So this will close all open documents except the document you've got open - there's no prompts -it just closes without saving them.

// Close all open documents except the active one
if (app.documents.length > 1) {
    for (var i = app.documents.length - 1; i >= 0; i--) {
        var doc = app.documents[i];
        if (doc != app.activeDocument) {
            doc.close(SaveOptions.NO);
        }
    }
}

Runs only when executed manually.
Closes all documents except the active one without prompting - if you want to Save the changes then change it to YES
Doesn’t require adding it to the startup scripts folder

 

https://community.adobe.com/t5/indesign-discussions/close-all-documents-in-one-shot-or-just-one/m-p/14997228#:~:text=everyItem().,all%20documents%20should%20be%20closed.

2 replies

Eugene TysonCommunity ExpertCorrect answer
Community Expert
February 11, 2025

Found a similar topic and modified the script (I think) 

So this will close all open documents except the document you've got open - there's no prompts -it just closes without saving them.

// Close all open documents except the active one
if (app.documents.length > 1) {
    for (var i = app.documents.length - 1; i >= 0; i--) {
        var doc = app.documents[i];
        if (doc != app.activeDocument) {
            doc.close(SaveOptions.NO);
        }
    }
}

Runs only when executed manually.
Closes all documents except the active one without prompting - if you want to Save the changes then change it to YES
Doesn’t require adding it to the startup scripts folder

 

https://community.adobe.com/t5/indesign-discussions/close-all-documents-in-one-shot-or-just-one/m-p/14997228#:~:text=everyItem().,all%20documents%20should%20be%20closed.

Participant
February 11, 2025

Perfect, thanks

I don't understand a thing though. Where do I have to paste this script?

Robert at ID-Tasker
Legend
February 11, 2025
quote

Perfect, thanks

I don't understand a thing though. Where do I have to paste this script?


By @Alessandro_Micioni

 

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

 

Robert at ID-Tasker
Legend
February 11, 2025

When there are links to other documents - InDesign opens them to check / synchronise information - not sure it can be avoided? 

 

Participant
February 11, 2025

Do you know if by any chance there is a sort of performance version to avoid the constant synchronisation of the links?

I can't find anything useful.

Robert at ID-Tasker
Legend
February 11, 2025

Not sure what do you mean by "performance version". 

 

Even when, in my tool, I test Hyperlinks for "validity" - InDesign will automatically open linked documents anyway. 

 

I think the only solution would be a small script, that will go through open documents and close the "unnecessary" ones. 

 

With my tool - it could be run as a WatchDog - but with "regular" scripting - you would've to run it manually.