Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Script to duplicate page/spread after current #14324032

    I ‘m not able to test if this actually works right now, but if you only need to duplicate the currently active page (i.e. not necessarily what you have selected), something like this might work:

    var activeDocument = app.activeDocument
    var activePage = app.activeWindow.activePage

    activePage.duplicate()
    activeDocument.pages[activeDocument.pages.length – 1].move(LocationOptions.AFTER, activePage)

    in reply to: Script to duplicate page/spread after current #14324057

    There’s an en dash on line 12 that should have been a regular dash. See the updated script here:
    https://gist.github.com/lassebrenden/ec2441937899b2458b0c4ffe6602a7de

    in reply to: Script to duplicate page/spread after current #114690

    Someone might find the following script useful.

    It duplicates each page in place instead of appending the duplicates to the end of the document (e.g. 1-2-3 becomes 1-1-2-2-3-3).

    // Define variables
    var file = app.activeDocument;
    var pages = file.pages;
    var numberOfPages = pages.length;

    // Duplicate each page
    for (i = 0; i < numberOfPages; i++) {
    file.pages[i].duplicate();
    }

    // Intertwine pages
    for (var i = 0; i < (numberOfPages – 1); i++) {
    var currentPage = (numberOfPages + i);
    var insertPoint = (i + i);

    file.pages[currentPage].move(LocationOptions.AFTER, file.pages[insertPoint]);
    }

Viewing 3 posts - 1 through 3 (of 3 total)