Skip navigation
HS_Potter
Currently Being Moderated

Get referenced pages of every pageReference in Index

Jun 18, 2012 10:47 AM

Tags: #index #book #topics #indexes #references #page_references

Hi there!

I'm working on a script that attempts to review all page references on each topic of an index in order to remove duplicates and build page ranges...

So far I get the referenceType for each pageReference, but it only returns the 'referenceType' and not the current page as the Indesign 8 Object Model says:

 

PageReferenceType.CURRENT_PAGE  (Read Only)

Data Type: number , Value: 1668444263

Adobe InDesign CS6 (8.0) Object Model

The page on which the index entry is located.

 

The followin script write in console each topic's name and its references (as 1668444263 if is of type CURRENT_PAGE), and I would like to get the real current page number...

 

Any help really appreciated!!

 

var index = app.documents[0].indexes[0];

for (i = 0; i < index.topics.length ; i++)

{

    $.write("Topic: " + index.topics[i].name + "\n");

        for (t = 0; t < index.topics[i].pageReferences.length ; t++)

        {

            var pRef = index.topics[i].pageReferences[t].pageReferenceType;

            $.write(pRef + "\n");

        }

}

 
Replies
  • Currently Being Moderated
    Jun 18, 2012 1:43 PM   in reply to HS_Potter

    The type tells you what type of index entry page number it is :)

    Try .sourceText -- http://jongware.mit.edu/idcs6js/pc_PageReference.html#sourceText -- this points to the insertionPoint in the actual text, the location of the index entry itself. From that you can use its parentTextframe and next that one's parentPage to get the page number (which should be the "name" of the page).

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2012 4:14 PM   in reply to HS_Potter

    You are welcome. I'm curious -- does your script generate a different index than ID's own?

     

    (I suppose this function could benefit from the odd enhancement here and there ... but usually that's done by cleaning up the generated index, for example with Peter Kahrel's Index Fixing script at http://www.kahrel.plus.com/indesign/index_update.html)

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2012 2:38 PM   in reply to HS_Potter

    HS_Potter wrote:

    > .. If u've found of know about any other way for working with indexes on books, please share and spare my head hitting the wall at nights…

     

    Quite the contrary :) Much as I like ID, its indexing features are just not good enough for Real World Indexes. Fortunately I don't have to create, correct, and maintain indexes. When asked to, I copy the ID text page by page to a Word document, let its concordance feature create a rough index for me, and send this back to the publisher for its editors to manually enhance/edit/adjust/amend.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points