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

How to alphabetical order pages at indesign cs4?

New Here ,
Feb 12, 2014 Feb 12, 2014

Copy link to clipboard

Copied

I have a text box at the beginning of each page and I want to alphabetical order pages based on that text box. Do you know how to do that?

TOPICS
Scripting

Views

3.6K

Translate

Translate

Report

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

Guru , Feb 13, 2014 Feb 13, 2014

This will do it.

But see also http://forums.adobe.com/thread/1082984?tstart=0 for a better workflow.

For some reason the OP over there didn't get back to say thanks and mark the answer as correct .

Trevor

// 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

...

Votes

Translate

Translate
Community Expert ,
Feb 12, 2014 Feb 12, 2014

Copy link to clipboard

Copied

I've moved this to the scripting forum. If anyone knows, it will be the users here.

Votes

Translate

Translate

Report

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
Guru ,
Feb 13, 2014 Feb 13, 2014

Copy link to clipboard

Copied

This will do it.

But see also http://forums.adobe.com/thread/1082984?tstart=0 for a better workflow.

For some reason the OP over there didn't get back to say thanks and mark the answer as correct .

Trevor

// 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.textFrames.everyItem().getElements().slice(0);

        n = i = pageFramesTops && pageFramesTops.length;

        if (!i) continue;

        while (n--) pageFramesTops = pageFramesTops.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.textFrames[0];

        for (var n = 0; n< i ; n ++) {

            if (pageFramesTops < topFrameHeight) {

                topFrameHeight = pageFramesTops;

                topFrame = doc.pages.textFrames;

            }

        }

        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.page.move (LocationOptions.AT_BEGINNING);

}

Votes

Translate

Translate

Report

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
New Here ,
Feb 13, 2014 Feb 13, 2014

Copy link to clipboard

Copied

Trevor,

Thank you so much! However I am very new in indesign and I even don't know how to add this script into my document

I hope I am not being a pain! Could you  help me on that?

Many thanks...

Votes

Translate

Translate

Report

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
Guru ,
Feb 13, 2014 Feb 13, 2014

Copy link to clipboard

Copied

In InDesign go to the scripts panel

Alt  +(Ctr / Command) + F11

or Ctrl enter then type scripts and select script panel

or go to Windows / Utilities / Scripts

Then on the panel right click the user folder and click on the USER folder and click on reveal in explorer

You now have have the script folder open

Copy the above script and paste it into any text editor.

Save it in the script folder with the extension .jsx

Alphabetical Page Sort.jsx might be a good name to choose.

Lock in the script panel and you should see the script there in the User folder

Click on it to run it.

If the script does not appear there then close and reopen the scripts panel.

Votes

Translate

Translate

Report

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
Guru ,
Feb 13, 2014 Feb 13, 2014

Copy link to clipboard

Copied

P.s.

I think Peter would agrea that the correct answer should go to me and not him

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 13, 2014 Feb 13, 2014

Copy link to clipboard

Copied

Absolutely, and I've made the change.

You're lucky I'm still subscribed.

Votes

Translate

Translate

Report

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
Guru ,
Feb 13, 2014 Feb 13, 2014

Copy link to clipboard

Copied

Thanks Peter,

Ever indebted

Votes

Translate

Translate

Report

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
New Here ,
Feb 13, 2014 Feb 13, 2014

Copy link to clipboard

Copied

Thank you... very much appreciated and helpful!

Votes

Translate

Translate

Report

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
Contributor ,
Nov 09, 2018 Nov 09, 2018

Copy link to clipboard

Copied

YAHOO!!! SO GRATEFUL for this script... just used it myself too

Votes

Translate

Translate

Report

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
New Here ,
Aug 04, 2023 Aug 04, 2023

Copy link to clipboard

Copied

I tried this and the script keeps giving me this error (on a mac) any tips? 

Votes

Translate

Translate

Report

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
New Here ,
Feb 15, 2024 Feb 15, 2024

Copy link to clipboard

Copied

Hello Trevor! I have a similar situation and I have been trying to make it run without success... I get this error: 

For Trevor.jpg

 

Any ideas?

Votes

Translate

Translate

Report

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
New Here ,
Feb 15, 2024 Feb 15, 2024

Copy link to clipboard

Copied

LATEST

Nevermind! Figured it out. I had some paragraph breaks in the header. You are supposed to have only one line. Thank you!

Votes

Translate

Translate

Report

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