0 Replies Latest reply on Jun 27, 2016 6:27 AM by m.ah

    Organise Selected Pages Alphabetically Indesign CC

    m.ah

      I have organised an indesign document into different sections each section has around 20 pages that need to be sorted alphabetically by the title of the page.

      Is there any way to do this?

      Ive used this script so far, However I need a way to be able to sort alphabetically each section of the document. For example- Pages 2-15 then Pages 18-40

       

      Any help would be great!

       

      // Script to sort Pages according to alphabetical order of their top TextFrames contents  // by Trevor (www.creative-scripts.com [coming soon]) custom and readymade scripts for InDesign  // http://forums.adobe.com/thread/1405293?tstart=0  // see also http://forums.adobe.com/thread/1082984?tstart=0 for a better workflow    app.doScript("aToZPageSort()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Sort Pages By top text contents");  function aToZPageSort () {      var doc =  app.documents[0],            myPageIndex = [],            l = doc.pages.length,            topFrameIndex = z= 0, pageFramesTops, i, topFrameHeight, topFrame;      while (l--) {          pageFramesTops = doc.pages[l].textFrames.everyItem().getElements().slice(0);          n = i = pageFramesTops && pageFramesTops.length;           if (!i) continue;          while (n--) pageFramesTops[n] = pageFramesTops[n].geometricBounds[0]; // for some reason when one trys to get the geometricBounds[0] from teh everyItems without the elements it return y1, x1 and not just y1 ?-)          topFrameHeight = pageFramesTops[0];          topFrame = doc.pages[l].textFrames[0];          for (var n = 0; n< i ; n ++) {              if (pageFramesTops[n] < topFrameHeight) {                  topFrameHeight = pageFramesTops[n];                   topFrame = doc.pages[l].textFrames[n];              }          }          myPageIndex [z++] = {page: topFrame.parentPage, contents: topFrame.contents.toLowerCase()}      }      myPageIndex.sort (function (a,b) {return (a.contents.toLowerCase() > b.contents.toLowerCase())});        l = myPageIndex.length;      while (l--) myPageIndex[l].page.move (LocationOptions.AT_BEGINNING);  }