Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Save docs in a book without updating page numbering

Engaged ,
Jan 10, 2019 Jan 10, 2019

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();

}

TOPICS
Scripting
468
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 10, 2019 Jan 10, 2019

Maybe disable automatic pagination:

app.books[0].automaticPagination = false;

P.

Translate
Community Expert ,
Jan 10, 2019 Jan 10, 2019

Maybe disable automatic pagination:

app.books[0].automaticPagination = false;

P.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 11, 2019 Jan 11, 2019
LATEST

Yes! That was the solution. Thanks Peter!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines