Skip to main content
Participating Frequently
February 11, 2009
Question

InDesign CS2 Error adding bookContents to a book

  • February 11, 2009
  • 6 replies
  • 1506 views
Hi all,

I want create a book in InDesign CS2 and add indesign documents to it using javascript and I get this error //ERROR:Process aborted by user What's wrong with this script?

//DESCRIPTION: Create a book and add indd-files of a choosen folder
var path = "//Users/INDD";
var bookname= "BookINDD";

var myFolder = new Folder(path);
if( myFolder != null ){
// get indd-files of choosen folder
var myFiles=myFolder.getFiles( ficheroIndd );
if ( myFiles.length > 0 ){
var myBookFileName = myFolder + "/"+ bookname + ".indb";
var myBookFile = new File( myBookFileName );

//the book file exists
if(myBookFile.exists){
var myBook=app.open( myBookFile );
myBook.automaticPagination=true;
}else{
//the book file doesn't exist, so make a new one
var myBook=app.books.add( myBookFile );
myBook.automaticPagination=true;
}
//add indd-files to a book
for ( i=0; i < myFiles.length; i++ ){
myBook.bookContents.add( myFiles ); // ERROR:Process aborted by user
}
myBook.save( );
}
}

Thanks,
Chus.
This topic has been closed for replies.

6 replies

Participating Frequently
February 12, 2009
Thanks Dave I'm going to try.
Participating Frequently
September 30, 2009

Hello,

Did you find the reason why it didn't work?

I do have the same problem with indesign server.

I was thinking it might comme from plug-in, not installed on the server, but installed on my PC?

Any idea?

Thanks a lot,

Anne Laure

Inspiring
February 11, 2009
Check that the filter is working by adding:

alert(myFiles.name);

before the add command. This will tell you:

a) whether or not it is working
b) which file is causing the problem.

Dave
Participating Frequently
February 11, 2009
I have built manually the book (BookINDD.indb) and then, I have added the files *.indd, and it's posible, so I don't know where is the problem when I'm executing the script in InDesignServer CS2

Chus
Inspiring
February 11, 2009
Have you tried manually constructing the book in question? Could it be that some of those files are unsuitable for inclusion in the book and so are breaking the script?

Dave
Participating Frequently
February 11, 2009
Hi Dave
The idea is filter the files "*.indd" of the folder "Users/INDD" and then insert them in the book "BookINDD.indb". This script must be executed on InDesignServer. When I executed it, I get the error // ERROR:Process aborted by user, in the next line of the script: myBook.bookContents.add( myFiles );

I write de script again:

//DESCRIPTION: Create a book and add indd-files of a choosen folder
var path = "//Users/INDD";
var bookname= "BookINDD";

var myFolder = new Folder(path);
if( myFolder != null ){
// get indd-files of choosen folder
var myFiles=myFolder.getFiles( "*.indd" );
if ( myFiles.length > 0 ){
var myBookFileName = myFolder + "/"+ bookname + ".indb";
var myBookFile = new File( myBookFileName );

//the book file exists
if(myBookFile.exists){
var myBook=app.open( myBookFile );
myBook.automaticPagination=true;
}else{
//the book file doesn't exist, so make a new one
var myBook=app.books.add( myBookFile );
myBook.automaticPagination=true;
}
//add indd-files to a book
for ( i=0; i < myFiles.length; i++ ){
myBook.bookContents.add( myFiles ); // ERROR:Process aborted by user
}
myBook.save( );
}
}

Thanks in advance
Chus
Inspiring
February 11, 2009
So what does your function ficheroIndd look like? It looks as though it is intended to filter .indd files so that other files in the folder are ignored, but if it is not working correctly that would explain the problem.

Dave