2 Replies Latest reply on Apr 10, 2012 4:24 AM by HH_BFS

    Creating TOC: order of anchored objects

    HH_BFS Level 1

      Hey scripting experts,

      i have a question creating an automated table of contents.

      The problem is, that I am using anchored objects (text) in a text frame/story.
      Let's assume there is a text frame, starting with the anchor of an anchored object that contains the "headline # 1" and is placed e.g. on the top of the page. The anchor is followed by "headline #2" and "headline #3" (both simple text, no anchored object).

      When generating toc, the order of the headlines will not be read as desired. The anchored object unfortunately is not added at first, but at the end. So the generated order is: #2, #3, #1. I would prefer #1, #2, #3.


      Do you think, there might be a suitable (and scriptable) way to teach InDesign, to count an anchored object according to the position of the corresponding anchor in the text? Yes? I would be glad for any advice!


      Thank you!



        • 1. Re: Creating TOC: order of anchored objects
          Peter Kahrel Adobe Community Professional & MVP

          A few months ago I run into a similar problem with anchored frames: searching them and then processing them. The array of found frames was not in order of occurrence, but (probably) in order of creation. The problem you describe probably has the same cause. The solution would be to collect the frames, then compare the story offset of their anchors. You would probably have to abandon your InDesign-created toc and write a script for it.



          1 person found this helpful
          • 2. Re: Creating TOC: order of anchored objects
            HH_BFS Level 1

            Hi Peter,


            thank you very much for your quick and technically versatile reply! Unfortunately my answer reaches you slightly late – due to Easter/holidays (hopefully you spend them relaxed ...).


            Nevertheless i am really glad having received your hint. At the moment i am still a bloody beginner in scripting/xml-rules, but trying hard to forge ahead. Maybe aming for a specific target causes progress ... You signalized me there probably is a solution, so with your hint at the back of my mind, i will start practicing now.


            Many thanks and best regards