Thread View: adobe.scripting.indesign
7 messages
7 total messages
Started by chus
Wed, 11 Feb 2009 09:52
InDesign CS2 Error adding bookContents to a book
Author: chus
Date: Wed, 11 Feb 2009 09:52
Date: Wed, 11 Feb 2009 09:52
30 lines
1633 bytes
1633 bytes
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[i] ); // ERROR:Process aborted by user } myBook.save( ); } }
Thanks,
Chus.
Re: InDesign CS2 Error adding bookContents to a book
Author: Dave_Saunders
Date: Wed, 11 Feb 2009 12:17
Date: Wed, 11 Feb 2009 12:17
3 lines
827 bytes
827 bytes
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
Re: InDesign CS2 Error adding bookContents to a book
Author: chus
Date: Wed, 11 Feb 2009 14:24
Date: Wed, 11 Feb 2009 14:24
31 lines
1821 bytes
1821 bytes
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] );
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[i] ); // ERROR:Process aborted by user } myBook.save( ); } }
Thanks in advance
Chus
Re: InDesign CS2 Error adding bookContents to a book
Author: Dave_Saunders
Date: Wed, 11 Feb 2009 14:45
Date: Wed, 11 Feb 2009 14:45
3 lines
807 bytes
807 bytes
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
Re: InDesign CS2 Error adding bookContents to a book
Author: chus
Date: Wed, 11 Feb 2009 15:20
Date: Wed, 11 Feb 2009 15:20
3 lines
824 bytes
824 bytes
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
Re: InDesign CS2 Error adding bookContents to a book
Author: Dave_Saunders
Date: Wed, 11 Feb 2009 15:51
Date: Wed, 11 Feb 2009 15:51
10 lines
831 bytes
831 bytes
Check that the filter is working by adding: alert(myFiles[i].name); before the add command. This will tell you: a) whether or not it is working b) which file is causing the problem. Dave
Re: InDesign CS2 Error adding bookContents to a book
Author: chus
Date: Thu, 12 Feb 2009 08:16
Date: Thu, 12 Feb 2009 08:16
1 lines
620 bytes
620 bytes
Thanks Dave I'm going to try.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads