• Register
Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.

Export several files using API

0 votes

I'm using API to export all the opened files. But In5 randomly skips some files. Why?

Here's the code:

if(app.documents.length != 0){
     for(var myBaseCounter = app.documents.length-1;myBaseCounter >= 0; myBaseCounter--){

     // Make current counter document the active
     var doc = app.documents[myBaseCounter];
     app.activeDocument = doc;

     // Run the API
          Here I put my export preferences.

          It works fine when a few documents (2 or 3) are opened.
          But, when I open 10 or 15 files and run this script
          In5 randomly skips some files.
          In ExtendScript's Javascript Console I can see that in5
          had processed all the files but no HTMLs have been generated.
asked May 22, 2017 in how_to by marcelo.moreira (140 points)
Looking for an answer?  Share this question:
I've find a way using books:

var activeBook = app.activeBook;
for (var myBaseCounter = 0; myBaseCounter < activeBook.bookContents.length; myBaseCounter++) {
        var doc = app.open(activeBook.bookContents[myBaseCounter].fullName);

But, there is a way to do it only on selected itens of the book?
Please send me your complete code so I can review it and see there might be issues inside of the export preferences.

Please log in or register to answer this question.