Skip to main content
dublove
Legend
Nov 24, 2026 7:33 AM UTC
Answered

Does Indesign support background silent opening?

I tried to retrieve the paragraph style name of another document without opening it.

I searched online for this:
//The second parameter false=not placed before, and the third parameter true=dontPlace (opened in the background)

var doc = app.open(File("/path/to/file.indd"), false, true);  

It seems like there's only one like the following:

//Skip missing word check
var doc = app.open(File("/path/to/file.indd"), false); 

 

    rob day
    rob dayCorrect answer
    Community Expert
    Nov 24, 2026 10:23 AM UTC

    and the third parameter true=dontPlace (opened in the background...

     

    Also, the 2nd parameter (true/false) lets you choose whether to show the window. The 3rd parameter is an OpenOption, (not true/false). Lets you choose default, open a copy, or open original:

     

    https://www.indesignjs.de/indesignapi/indesign/OpenOptions.html

    6 replies

    Community Expert
    Nov 24, 2026 8:31 AM UTC

    Is there a particular reason you need to open the source document? If you're simply looking to import paragraph styles from another InDesign file, you can use

    importStyles()

    without explicitly opening the source document.

    If you're only looking to retrieve the style names, you could import them into a temporary hidden document, interrogate the styles and discard the temporary document afterwards.

    What’s the reason - cos there’s different ways to do it with different outcomes.

    Translate
    dublove
    dubloveAuthor
    Legend
    Nov 24, 2026 8:56 AM UTC

    ​@Eugene Tyson 

    If you're only looking to retrieve the style names, you could import them into a temporary hidden document, interrogate the styles and discard the temporary document afterwards.

    Temporarily hide documents?
    How to hide it?
    I finally used:

    var sourceDoc = app.open(File(styPath), false);
    . . .
    sourceDoc.close(SaveOptions.NO);

    I don't seem to feel the process of opening it either

    Translate
    Community Expert
    Nov 24, 2026 9:33 AM UTC

    That's exactly what the second parameter (false) does. It opens the document without creating a layout window, so you won't see the document opening in the InDesign interface.

    Similarly, you can create a new, hidden document using:

    var tempDoc = app.documents.add(false);

    In both cases, the document is open in memory and accessible through scripting, but isn't visible in the interface.

    What you've ended up doing is perfectly fine. You can retrieve the paragraph style names and close the document without saving.

    Just be aware that opening without a window doesn't necessarily suppress warning dialogs. For that, you can temporarily set the script's user interaction level to

    UserInteractionLevels.NEVER_INTERACT,

    remembering to restore the previous setting afterwards.

    Translate