Skip to main content
KlausFriese
Inspiring
May 16, 2017
Question

How to find out if a Document is part of a book?

  • May 16, 2017
  • 2 replies
  • 782 views

Hello,

Is there a simple way to find out if a document is part of a InDesign book and to check if this book is also opened? I didn't find anything in the documentation.

I know that I can check the list of open books and look if the document is part of one of this books. But I hope there is a kind of isInBook() function that I didn't found.

Thanks for any tipps

Klaus

This topic has been closed for replies.

2 replies

KlausFriese
Inspiring
May 17, 2017

Thanks - writing my own function to test this is not the problem - I'm just wondering that there was no build in function for that.

Community Expert
May 16, 2017

Hi Klaus,

no. I don't think so, there is no simpler way.


You possibly could write a parser that could filter out the paths and names of InDesign documents that are in a closed book file.

I inspected a book file with my text editor and the paths could be identified in readable form with their platform specific encoding.

Regards,
Uwe

Legend
May 16, 2017

tell application id "com.adobe.indesign"

  -- exists (book contents of every book whose full name is full name of active document)

  full name of active document is in (full name of every book content of every book)

end tell

If the search should only consider the opened books, the commented out line would be the fastest (in execution time) solution. Unfortunately Adobe never supported the full power of AppleScript, where you could push that kind of expressions into the scripted application. The line below works by building a list and performing the search in the AppleScript runtime.

Translating that to ExtendScript requires a shim for Array.indexOf ...

("…"+app.books.everyItem().bookContents.everyItem().fullName.join("…")+"…").indexOf("…"+app.activeDocument.fullName+"…")>=0

Btw, I would not rely on those strings from book contents without thorough testing - books can get moved in the FS. Some of the properties used to be redundant and/or only partially maintained when a book recovered from such a move, I never checked whether that was cleaned up internally in the file format when the bug was fixed ages ago.

Dirk