Script to rearrange the pages?

I'm looking for a script to reorder pages in a large document (a few hundred pages).

I need to be able to create the new order based on the former page numbers [for example: I need to specify that the new order must be 100, 3, 9, 212 178... all reference to the original page numbers.] When I move pages manually former page numbers are no longer valid, that's why I can't do it manually.

Anyone who has seen/written such a script is invited to respond, and all those who would be willing to try to write a.  Thank you.

Hey, it was a lot harder than I thought!

This script seems to work - but it's true, I only tested with a document of 20 pages and some random reiterations. Run on a copy of your document and scream if she isn't good. (And boyo, I hope it works...)

You can fill your new command in the first line, separated by commas. You can also enter a range, such as "5-10", if you happen to have a few pages in the original order. All numbers must be entered inbetween the quotes on a single line.

var order="1,20,2,19,3,18,4,17,5,16,6,15,7,14,8,13,9,12,10,11";
// Create an array out of the list:
ranges = toSeparate (order);
if (ranges.length != app.activeDocument.pages.length)
{
 alert ("Page number mismatch -- "+ranges.length+" given, "+app.activeDocument.pages.length+" in document");
 exit(0);
}
// Consistency check:
sorted = ranges.slice().sort(numericSort);
for (a=0; a -1)
  {
   indexes = s[l].split("-");
   from = Number(indexes[0]);
   to = Number(indexes[indexes.length-1]);
   if (from >= to)
   {
    alert ("Cannot create a range from "+from+" to "+to+"!");
    exit(0);
   }
   s[l] = from;
   while (from < to)
    s.splice (++l,0,++from);
  }} catch(_){}
 }
// s.sort (numericSort);
 return s;
}
function numericSort(a,b)
{
 return Number(a) - Number(b);
}

Copy and paste into a text editor - the editor ESTK which comes with InDesign is correct - and save it as "rearrangePages.jsx" in your script file. It becomes immediately available in your Scripts panel. Then just double-click to run.

It should warn you to duplicate as well as some other incompatibilities issues I could think. If an error ("cannot create range"), your input is bad. If it warns you when executing ("problem with page... "), it cannot move this page for some reason any...

Absolutely no warranty. Run on a single copy. It can severely damage your Document if it won't.

Tags: InDesign

Similar Questions

  • I want to rearrange the pages easily!

    Hello to all and in particular the Apple team

    I would like to rearrange the pages using my iBook: apparently this simple feature is not possible. Sounds very weird.

    iBooksI am design are the photo portfolios and so the pages are not related specifically to each other - a simple drag and drop would be great for the reorganization of the pages.

    Please, I beg you! You could Apple team ofiBooksAuthor - free us from this odd restriction. There should be an option when creating an ebook: power related pages.

    Thank you

    Best regards

    What you want, it's a non-linear editing.

    iBA, a linear editor that builds strictly on XML scripted, has never been placed in this area - also note you aren't one to notice, which means Apple has heard this lament from the first day, and no imminent change. I wouldn't hold my breath on a change of iBA direction anytime soon.

    A simple movement of Pages, LibreOffice or Word would solve your problems immediately.

    And given that the forum posts generally do not count as comments, see: http://www.apple.com/feedback/ibooks-author.html

    Good luck.

  • How to rearrange the pages of a PDF portfolio

    Acrobat is forcing me to combine 2 PDFs in a PDF portfolio.  OK, that's done, but I need to rearrange the pages and I can't drag and drop.  What I am doing wrong? \

    OMG - thank you very much.

    I'm looking to use portfolios to appease customers who want to be able to rearrange the sections in our notes.

    Workaround: Save each 'section' in separate PDF and bring together them in a portfolio. Visitors can reorganize the sections for the delight of their heart.

    Bonus: The many illustrations and tables is more need to be formatted to adjust a document (section break/landscape/etc.).

    If DC broke the ability to rearrange the files in a portfolio, it's certainly not for me.

  • How do I rearrange the pages once they are in adobe acrobat format?

    I have a NeatDesk who scans my pages in Adobe Acrobat PDF. But when my scans must be the combination of size size and the receipt of letters, he puts them out of use. How can I rearrange the pages scanned once they have been created in several page PDF format?

    In browsing the Pages panel, you can move pages.

  • Whenever I connect to Facebook my computer starts freezing, running slow and window pops up saying there is a script running on the page.

    Original title: another scrpt running on the page

    whenever I log in Facebook my computer began to freeze and sometimes throws me completely. If not, it runs very slowly and window pops up saying that a script is running on the page which is the origin of the page to run slowly and can freeze your computer, press Yes to continue.how can I get rid of this

    Hi Eva,

    1. what web browser do you use?

    2. What if the problem occurs with all the site or it confined to Facebook?

    3. did you of recent changes on the system?

    Method 1:

    If you use Internet Explorer, you can view the following items and check if it helps.

    How to resolve script errors in Internet Explorer on Windows computers

    Error message: "a script on this page slows down Internet Explorer runs slowly.

    Method 2:

    You can also try the steps in the following link and check if this solves the problem.

    How to optimize Internet explorer?

    Hope this information is useful.

  • Create a single pdf document from multiple scans of a doc to double-sided printing. What is the simpler, faster way to rearrange the pages in their correct order?

    I am currently trying to create a single pdf file of several analyses of groups of pages in a document of front and back of the page. The manual is about 80 pages and I didn't scan each page regardless. Is there a way to move pages once they are all together in a single pdf? All odd pages are in order. However, two other analyses allowing same abd pages, they are at the end after the odd pages.

    Open the Pages panel on the left and you will be able to drag and drop the

    thumbnails of page around.

  • Can I change the order of the pages in the script?

    Hello, my question is quite simple, that I wonder if it is possible to rearrange the pages in the form of script?

    Just as a brief description, my form is sort of work order/list control but when finished, I want to be able to rearrange the pages of forms to create a report.

    My first thought was that it would seem like a trivial thing, and there will be some sort of option to change the page number of each page of form or something like that, but I found no information by Googling unfortunately.

    I'm often with some sort of way to get around the limitations and what I think or if there is no easy way to move things by script is just to have a page in the 'other place' duplicate hidden in a first time, and to "pass" a page, I just hide the page where it is initially and then view the page in double on the secondary site.

    Again, this would be quite heavy, having to have duplicate pages and scripts of all areas for synchronize. So, I was hoping for some xfa.layout. shenanigans? Is there a way to actually reorder the pages in the script, or do I have to play hide and show?

    (On a side note, I do not seem to find any material reference on the object xfa.layout? it exists somewhere, as I have a problem to find in the regular documentation.) Using LiveCycle Designer ES2 btw.)

    Best regards, Mattias

    I'm afraid that the show / hide approach may be your only other option. LiveCycle is model based, not paginated. It is a key element of the tool because it allows content dynamically flow across multiple pages on content requirements.

  • Script to apply the master spread

    Hello

    This Script is for the page master opener co applying everywhere where CN is applied, when we run the script, it warns Sucess.But master spread is not applied. Please resolve.

    var mydoc=app.activeDocument; 
    var mypara = mydoc.stories.item(0).paragraphs.everyItem().getElements();
    for(i=0; i<mypara.length; i++){
        if (myPara[i].appliedParagraphStyle.name=="CN"){
               mypara[i].parentTextFrames[0].parent.appliedMaster = mydoc.masterSpreads.item("CO-Opener");
            }
        }
    alert("Master Page applied Sucessfully")
    

    Hi Math,

    I hope that your code is correct, but it seems [0] stories have no Styles "CN".

    Change the threshold:

    var = mydoc.stories.item mypara (0).paragraphs.everyItem () .getElements ();

    in

    var mypara = mydoc.stories.everyItem ().paragraphs.everyItem () .getElements ();

    Thanks Jongware and Green4ever...

    and also the use of the below url to get coding right for CS4 and CS5 and higher

    Apply the Master Page by using the paragraph Style

    var myDocument = app.activeDocument;
    var myParas = myDocument.stories.everyItem().paragraphs.everyItem().getElements();
    var myPage = myDocument.pages;
    for(i=0; i
    

    Concerning

    Siraj

  • Save the Page Arrangement for continuous draft PDF

    I just used Acrobat Pro to create a PDF file of 50 pages (like a master file for printing a book of Magcloud.com). I created the pdf file of 50 individual jpeg files, use combine Acrobat files in PDF function.

    But as I work on the book, whenever I want to rearrange the pages or add or subtract pages for a new project, I have to drag - reorder pages from scratch, with all the files in the window to combine the files once more in the original order. I lose the page layout when I Quit Acrobat or even when I create a pdf file.

    I know I can number the original files so that they appear automatically in the correct order, but it's a bad solution: fifty files renaming is not negligible, and it is also impossible to move a file without renaming it dozens of others. If this isn't a good solution.

    Is there a way to keep the layout of the files so that it appears in Acrobat, even after I have created a pdf file, or once I left Acrobat?

    Thanks for any help.

    Once you have assembled and recorded the 50 page PDF file, the order of the pages will not change when you close and re-open.

    To move existing pages in the document, open the navigation panel Pages on the left side of the window, and then drag the thumbnails autour. To add a new page, use the Tools menu on this Panel and delete a page simply click on the thumbnail to select it, then press delete.

  • Change the Page numbers in the index

    Hello

    I have a catalog and I added two pages in the middle of the catalog. Now, due to the addition of two pages, I need to update the page numbers on the index with the new page numbers. I only need to increase each of the page by two numbers, but that starts only at a certain point. Thus, for example, on one of the index I have, 1-70 page numbers may remain the same, since the two extra pages were added AFTER page 70. But every number after 70 must increase by 2.

    I have a find and replace script. I create a table in excel and drop into the document. The script then takes any word or number that is listed in column A and replace it with what is in column B. I used initially this script to find and replace in the catalog product codes, and it worked great, because all the product codes were quite unique.

    Try to use this same script to change the page numbers, but she totally fizzled. The problem is that the same number is repeated later in the table, so the script has the table constantly replace all numbers with the first two. So, here is a small sample of my table:

    Col Col B

    423 425

    422 424

    421 423

    420 422

    But when I run the script, here is what it will turn into:

    Col Col B

    423 becomes 425 425

    422 becomes 424 424

    421 becomes 425 423 becomes 425

    420 becomes 424 422 becomes 424

    Because it alters the table, all corresponding numbers in the document then will increase to 425 or 424.

    Is there a way to ensure that the script does not change the information in the table that she uses as a reference?

    Here is the script below. I didn't write (makes a very nice person on these forums) and don't know anything about the scripts.

    the_table = app.selection [0] .tables [0];
    app.findChangeTextOptions = null;
    with (app.findChangeTextOptions)
    {
    caseSensitive = true;
    wholeWord = true;
    }
    app.findTextPreferences = null;
    app.changeTextPreferences = null;
    for (row = 0; row < the_table.rows.length; line ++)
    {
    If (the_table.rows [row] .cells [0] .silence == ")
    continue;
    app.findTextPreferences.findWhat = the_table.rows [row] .cells [0] .silence;
    app.changeTextPreferences.changeTo = the_table.rows [row] .cells [1] .silence;
    app.activeDocument.changeText ();
    }

    Thank you very much!

    It should work, but make sure you do backup first. I'm not going to say once: first make a backup copy. Yes, I said that you should make a backup first!

    Copy the following script, paste it into an editor appropriate - Adobe ESTK which comes with InDesign is good enough. Save it as "omgwrongnumbers.jsx" in your user Scripts folder. Select as little text as possible, the script will be blindly increment (or decrement) all numbers in the range. And then double-click the script runs.

    //DESCRIPTION:omg the page numbers are all wrong!
    // A Jongware Script 18-Aug-2010
    if (app.documents.length == 0)
    {
         alert ("Oh give me some text to play with :'(");
         exit(0);
    }
    if (app.selection.length != 1)
    {
         alert ("We can't go on like this. Select some text first.");
         exit(0);
    }
    
    myDialog = app.dialogs.add ({name:"omg the numbers are wrong!",canCancel:true});
    
    with (myDialog)
    {
         with (dialogColumns.add())
         {
              with (dialogRows.add())
                   staticTexts.add ({staticLabel:"First to change"});
              with (dialogRows.add())
                   aBox = integerEditboxes.add({editContents:"1"});
              with (dialogRows.add())
                   staticTexts.add ({staticLabel:"Last to change"});
              with (dialogRows.add())
                   bBox = integerEditboxes.add({editContents:"99999"});
              with (dialogRows.add())
                   staticTexts.add ({staticLabel:"Add or subtract this value"});
              with (dialogRows.add())
                   cBox = integerEditboxes.add({editContents:"2"});
         }
    }
    if (!myDialog.show())
    {
         myDialog.destroy();
         exit(0);
    }
    first = aBox.editValue;
    last = bBox.editValue;
    step = cBox.editValue;
    
    if (first < 1 || first > last || step == 0)
    {
         alert ("Now you're pulling my nose arentya");
         exit(0);
    }
    app.findGrepPreferences = null;
    app.findGrepPreferences.findWhat = "\\b\\d+\\b";
    list = app.selection[0].findGrep(true);
    changes = 0;
    for (i=0; i= first && n <= last)
              changes++, list[i].contents = String(n+step);
    }
    alert ("Number of changes: "+changes);
    
  • The script in my web page is on the left side?

    The script on my web page is a letter on top of the other. Menu names and the script on the page. If I open a Google search bar research shows the script one above the other. Is there a setting that I can change? I've updated Järva. This on a Win 7 OS.

    Please post a screenshot of that.

    See this support article.
    How to make a screenshot of my problem?
    It is best to use a type of compressed as PNG or JPG image to save the screenshot and make sure you do not exceed a maximum file size of 1 MB.

    Then use the button Browse... below the text message response area to download the screenshot.

  • I can't get Firefox to play the horizons of music on the pages in browsers, it works in IE and other browsers but not firefox, HTML or Java script must also use so that they work?

    I'm having a problem with firefox, play background music on some sites, it works with IE and other browsers, but not with fire fox, what html script or java I must add to the pages so that they play music?

    I am developing my pages front page and I know the music only works on IE, so if someone can tell me how to fix this because it is important that I use fire fox as my main browser.

    Thank you in advance

    If a site uses BGSOUND so this will only work in Internet Explorer.

    BGSOUND is not compatible with other browsers like Firefox.

  • error in script on the page

    I shave started getting an error of script on the page.  It seems to have started after a Windows Update.  I'm unable to enter some pages like the blue circle goes around and around and does not stop.

    Line 1: 1 tank: ' components is undefined. " code 0: url chrome://simppulltollbar/content/lib/external.js

    Is there a solution for this?

    Welcome & thank you for your comments.

  • Get a script error when you try to print, and when I print the black ink is very light on the page. I replaced the ink already, it's a hp officejet 6500wireless.

    Get a script error when you try to print, and when I print the black ink is very light on the page.  I replaced the ink already, it's a hp officejet 6500wireless.

    See if this helps:

    http://support.Microsoft.com/kb/308260

    Tom Ferguson

  • Hide the page looping script

    Hello

    I use jdeveloper 11.1.1.7.0.

    I have an ADF Application with ADF, security (auth-method FORM).

    In my login page (Login.jspx) users are fully authenticated and redirected to another secure page. Everything works beautifully.

    But on Login.jspx users, right-click on the page and select the option "View source" that says:

    -Chrome on 45.0.2454.101: page of script for looping

    -Mozilla FireFox 37.0.1: page of script for looping

    -Internet Explorer 9.0.8112.16421: 'Real' of the page source code

    What I want to know is how to prevent users from viewing the page looping script.

    I don't like to show the source code 'real' of the page (like IE for this).

    I do not want to hide the actual code of the page, but I need to hide the script loopback page because I think that it contains information about my request that users know not.

    Is it possible to take measures to avoid the page of script loopback?

    Attached files:

    Login.html: my looping script page

    Login.zip: Login.jspx + web.xml


    Concerning

    Roberto

    Refer

    Oracle ADF - leaving Competition In The Dust: ADF avoiding loopback script in servlets

Maybe you are looking for