Skip to main content
131772el
Participant
August 11, 2013
Question

open all documents of book

  • August 11, 2013
  • 2 replies
  • 744 views

Hello!

Me again, writing with Google Translate,  i'm sorry!

I'm pretty begins on the subject, hope this forum even for beginners.

If not, tell me and run away ...

Two questions:

A. Theoretically. When should I use "getElements" in addition to "everyItems"?

In. Why this script does not open all my book documents?

(Nothing happens)

if (app.activeBook! = undefined) {

     myBook = app.activeBook;

     for (var a = 0; a <myBook.bookContents.length; a + +) {

       myItem = myBook.bookContents.item (a);

       var myS = myBook.bookContents.item (a). status;

     if (myS! = "DOCUMENT_IS_OPEN") {

           app.open (myItem.filePath);

          }

         }

     }

Thank you!

This topic has been closed for replies.

2 replies

Participant
October 9, 2023

Hi! Here is an updated version of that script. Feel free to remove the "book is opened" comment. Was just using it to validate the opened book

Participant
October 9, 2023
quote

Hi! Here is an updated version of that script. Feel free to remove the "book is opened" comment. Was just using it to validate the opened book


By @Jaime327835277k0z



BEGINNER_X
Legend
August 11, 2013

Hello 13177el,

Use the below code, may it help to open the all book contents

Simple code:

if(app.books.length==0)

{

    alert("please open the book")

    }

var myBook = app.activeBook;

var myBookContents = app.activeBook.bookContents;

for(k=0; k<myBookContents.length; k++)

{

    var myTotalContents = myBookContents.fullName.toString()

    app.open(File(myTotalContents))

    }

For question A:

getElements(): Used to store the some values in the variable like

app.activeDocument.paragraphStyles.everyItem().getElements()

app.activeDocument.characterStyles.everyItem().getElements()

app.activeDocument.objectStyles.everyItem().getElements()

If the above code helps for you, then please click help or correct answers for me.

Thanks

Beginner

131772el
131772elAuthor
Participant
August 11, 2013

Thank you!!!

It worked.

(Just now I have to cancel the dialogues of rebounding questions...)