• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Participant ,
May 16, 2017 May 16, 2017

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

517

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 16, 2017 May 16, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 16, 2017 May 16, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 17, 2017 May 17, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines