5 Replies Latest reply on Apr 9, 2013 10:31 PM by Trevorׅ

    Moving frames upstream or downstream


      I'm new to InDesign scripting. Is it possible to programmatically move text frames upstream or downstream? My understanding is that numbered paragraphs are numbered by frame/story, not by order on the page. If I create a text frame after the document is set, I want to move that frame "upstream" so it is numbered before the main story. Is this an attribute I can change in a script? If so, what's the keyword I should be looking for when I dive in?


      Thanks so much!


        • 1. Re: Moving frames upstream or downstream
          TᴀW Adobe Community Professional & MVP

          Hi Aaron,


          Your question isn't very clear. What do you mean by "upstream" and

          "downstream"? What do you call a "numbered paragraph"? What do you mean

          by a text frame which is "numbered" before the main story?


          Could you elaborate?




          • 2. Re: Moving frames upstream or downstream
            AaronCA Level 1

            Numbered paragraph = a paragraph style that includes numbering (e.g., figure/table captions).


            Upstream/downstream is the terminology used in the InDesign documentation when talking about the order in which frames were created (i.e., earlier frames are upstream of later frames).


            The way numbering apparently works in InDesign is that numbers are generated on a story-by-story basis. Placement on the page is irrelevant. What matters is when each frame was created. So if I have a book chapter containing 4 captions and I want to extract the first one and put it in an un-anchored text frame, it will number that first caption as 4, not 1. InDesign numbers everything in the main story first and then each frame afterwards in date-created order.


            What I want to know is if that "date-created" attribute can be modified programmatically. As it is, if I want to change the order of my floats, I have to cut them all into a separate document and paste them back in in the correct order. (So frustrating. Even Word gets this aspect of numbering right!)


            I appreciate your time.


            • 3. Re: Moving frames upstream or downstream
              Trevorׅ Adobe Community Professional

              Hi Aaron,


              If your are talking about linked frames you can set the nextTextFrame and previousTextFrame properties


              If you are talking about non linked frames (which I think you are) then you can just use

              myFrame.bringForward () and myFrame.sendBackward () or

              bringToFront ([reference: PageItem])

              or myFrame.sendToBack ([reference: PageItem])


              Even if you were to cut and paste you would just use app.cut() and app.pasteInPlace() in the same document, but obviously the above method is better.



              • 4. Re: Moving frames upstream or downstream
                AaronCA Level 1

                Thank you, Trevor. I'll start there.

                • 5. Re: Moving frames upstream or downstream
                  Trevorׅ Adobe Community Professional

                  Aaron, please mark the question as correct

                  Thank you