0 Replies Latest reply on Sep 8, 2009 8:12 AM by edsonfurman

    Formating page references via script: how to iterate by index levels?

    edsonfurman

      I need to create a index with PageNumberStyleOverrides. I imported the story with index entries from Microsoft Word. I managed to put a flag in each entry that should be formated with a differente PageNumberStyle (the character ÿ, y with a umlaut). I created a script that functions perfectly, except that it does not "see" the subtopics' page references. That is, it applies the formatting only to Index Leve 1 page references, and I need with applies it to the other Index Leves (in this case, there is only another Level, the Level 2). What's wrong?

       

      Sub InDesignMyApplyPageStyleNumberOverride()
      Set myInDesign = CreateObject("InDesign.Application.CS3")
          If myInDesign.Documents.count > 0 Then
              Set myDocument = myInDesign.ActiveDocument
              Set MyIndex = myDocument.Indexes(1)
              Set MyTopics = MyIndex.Topics
              MyEventsCounter = 0
      On Error Resume Next

              For myTopicsCounter = 1 To MyIndex.Topics.count
              Set MyTopic = MyIndex.Topics.Item(myTopicsCounter)
              Set MyPageReferences = MyTopic.PageReferences
                  For MyPageReferencesCounter = 1 To MyPageReferences.count
                      myFlag = Right(MyTopic, 1)
                      If myFlag = "ÿ" Then
                          MyTopicLenght = Len(MyTopic)
                          MyLenght = MyTopicLenght - 1
                          MyNewTopic = Left(MyTopic, MyLenght)
                          Set MyPageReference = MyPageReferences.Item(MyPageReferencesCounter)
                          MyPageReference.PageNumberStyleOverride = "KEY_TERM"
                          MyTopic.Name = MyNewTopic
                          MyEventsCounter = MyEventsCounter + 1
                      End If
                  Next MyPageReferencesCounter
              Next myTopicsCounter
          End If
        MsgBox MyEventsCounter
      End Sub

      I would appreciate any help.

       

      EdsonFurman

      edsonfurman@terra.com.br