Copy link to clipboard
Copied
Referring to my thread, I would like to know how to avoid permanently checking page numbering of inDesign. In each loop, the script opens the base document, renames it, and saves it as a new document in the new book. It checks whether page markers are up-to-date. Now there are 20 large Documents in one book. You can imagine how long the conversion takes...
Just want to avoid the checking in the loop (line 67).
var myNewBook, newBookName, sv, myBook, myBookCont, myDocs, myDocsLength, myDocsPath, myNewDoc, versionierungVar, versionierungVarText;
if (app.books.length >1){alert("Sie haben mehrere Bücher offen!");exit;}
if(app.books.length == 0){openBook();}
else {var myNewBook = app.activeBook; bookName()}
function openBook(){
var myPath = new File ("/...");
var openFile = myPath.openDlg("Wähle die Datei aus");
while(openFile !== "null"){
myNewBook = app.open(File(openFile));
bookName();
}
}
function bookName(){
var d = new Window('dialog', 'Eingabefeld');
d.orientation = "column";
d.alignChildren = 'right';
var lineGroup = d.add ('group');
lineGroup.add('statictext', undefined, 'Buch umbenennen:');
var newBook = lineGroup.add ('edittext', undefined, myNewBook.name);
newBook.preferredSize.width = 550;
lineGroup.add('statictext', undefined, 'altes Versionskürzel:');
oldVers = lineGroup.add ('edittext', undefined, undefined);
oldVers.preferredSize.width = 50;
lineGroup.add('statictext', undefined, 'neues Versionskürzel:');
newVers = lineGroup.add ('edittext', undefined, undefined);
newVers.preferredSize.width = 50;
var buttonGroup = d.add("group");
buttonGroup.add('button', undefined, "Cancel");
buttonGroup.add('button', undefined, "Ok");
var res = d.show();
newBookName = newBook.text;
switch (res) {
case 2: alert("Dann halt nicht");
break;
case 1: saveBook();
break;
}
}
function createNewDocs(){
var myDocs = app.activeBook.bookContents.everyItem().getElements();
myDocsLength = app.activeBook.bookContents.count();thre
for (var i=0; i < myDocsLength; i++){
myDocsPath = myDocs.fullName;
myNewDoc = app.open(File(myDocsPath));
fileName = myDocs.name.replace(oldVers.text, newVers.text);
myNewDoc.save(File(myNewBook.filePath + "/" + fileName)); //"Grafik/Marketing 2015/Katalog/31_Sommer_2018/03_Grafik/Saalfrank/02_HK_AT_R3/02_Inhalt/"
myNewDoc.textVariables.itemByName("Versionierung").variableOptions.contents = "-" + newVers.text;
myNewBook.bookContents.add(myNewDoc.fullName);
$.sleep(150)
app.activeBook.bookContents[0].remove();
$.sleep(150)
myNewDoc.close(SaveOptions.yes);
}
myNewBook.close(SaveOptions.yes);
}
function saveBook(){
sv = File(myNewBook.name.replace(myNewBook.name, newBookName)).saveDlg("Bitte Speicherort auswählen: " + newBookName,"INDB files: *.indb");
myNewBook.save(File(sv.fullName)); //+ ".indb"
createNewDocs();
}
Maybe disable automatic pagination:
app.books[0].automaticPagination = false;
P.
Copy link to clipboard
Copied
Maybe disable automatic pagination:
app.books[0].automaticPagination = false;
P.
Copy link to clipboard
Copied
Yes! That was the solution. Thanks Peter!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now