Skip to main content
Inspiring
November 22, 2016
Question

Path from the Book-Object to a paragraph-styled content

  • November 22, 2016
  • 1 reply
  • 599 views

Hi everybody.

By now I understand, that it is not possible to come to a result with (commonplace-)logical conclusions.

This time I´d like to get all the contents out of a book which are formatted with a certain paragraph-style. I started with this:

app.activeBook.bookContents.everyItem().name

So I got the names of the documents the book contains. According to my logic, this is approximately equal: .document.name. Isn´t it?

The next logical step (for me) would be:

app.activeBook.bookContents.everyItem().pages.everyItem().name

But, of course, it´s the wrong way... Althought:

app.activeDocumentpages.everyItem().name

works!

Background of my intension is the creation of a nested loop in which I can collect different contents from different levels (eg. page numbers, documen-/chapter-numbers, etc.). Doesn´t exist a path as I wrote in the head of this thread?

This topic has been closed for replies.

1 reply

Jump_Over
Legend
November 22, 2016

Hi,

bookContent and document are two different object with different properties.

Main (logical?) reason is that a doc is a file opened by app but a bookContent can be 'missed', 'closed', 'out of date' and... so on. It is a 'draw' where doc is inserted.

You can refer to a doc - as a part of book - and you can use a bookContent.name - but

1. check if is opened

2. call it like app.documents.itemByName(bookContent.name)

Jarek

cmoke73Author
Inspiring
November 22, 2016

Hmmm ... of course they are.

But I thought one can "walk" along a path "downstairs" to the children of the objects by "collecting" whatever one need. I know, it is a very non-expert-like expression, but it makes it more clear how I think about. Maybe that has to change, my way of thinking.

Jump_Over
Legend
November 23, 2016

I think that good idea is to start here

ID CS5 Object Model

or another ID version.

Any path possible to walk - you can find there.

Jarek