2 Replies Latest reply on Mar 28, 2013 10:07 AM by SeanBonney

    How to auto-thread Text Frames?


      I am designing a document which refers readers to a Reader Service Card. Each ad needs a subsequent number and there may be multiple ads per page or pages without any at all. I've had some success by using this script:

      count = 0;

      str = "";

      while (count < 100)



      str += "Circle #"+count+" on reader service card."+"\r";


      app.selection[0].contents = str;



      This will fill the selected Text Frame with a long sequence of sentences with the number properly incremented, but I still have to manually thread each Text Frame to the next. If I change the order of ads or insert/remove one, the threading has to be redone.


      So is there a method of going through the document from beginning to end, selecting specific Text Frames and threading them together? I could run this every time the ad layout changes. Perhaps these Text Frames could be of the exact same size or be otherwise differentiated from the rest of the content so that the script could find them?

        • 1. Re: How to auto-thread Text Frames?
          Jump_Over Level 5



          There is a set of solutions here but did you consider to edit your ad's (is it a graphic file?) metadata content?

          If each of yours ad would have proper string in a metadata field, i.e. "description" => InDesign text variable would display it whereever you place (rearrange) the file/s.

          Using this, only you need is take care about proper file metadata content.




          • 2. Re: How to auto-thread Text Frames?
            SeanBonney Level 1

            Each ad is a graphic, specifically a PDF. I could edit the metadata, but the placement of the incremented number isn't the same for each one. Some are centered just below, some are superimposed over the graphic.


            I have actually made a lot of progress using paragraph numbering. Applying a style with "Circle # ^# on the reader service card" as the number style gives me:


            Circle # 1 on the reader service card

            Circle # 2 on the reader service card

            Circle # 3 on the reader service card


            --incremented on each Text Frame the style is applied to. This actually solves half my problem fairly simply.


            The next part is incremental numbers within a frame:


            IBM ibm.com - 1

            Costco costco.com - 2

            Apple apple.com - 3


            In this case I need the number to appear at the end of a paragraph, which doesn't seem to be supported within styles. Is there nothing like a programmable field in InDesign, where I could insert:


            IBM ibm.com - <<count>>

            Costco costco.com - <<count>>

            Apple apple.com - <<count>>


            --and have a script return an incremented number each time?