18 Replies Latest reply on Aug 20, 2009 2:43 PM by CatalogCreator

    Autoflow a story


      How do you autoflow a story created in the story editor that will fill several pages? In PageMaker scripting it was as simple as closing the story editor and placing the story at position X,Y with Autoflow selected. You did not have to create the text fame first.


      I am not asking anyone to write the code. I need a conceptual explanation.


      I did find this thread:




      Does InDesign CS4 still have this limitation? It's surprising to find this feature missing.

        • 1. Re: Autoflow a story
          Steven.. Level 3

          Here's some javascript code that I use.


          copy into file with .jsx extension and select frame with overflow and run script

          var doc = app.activeDocument;
          var sel = doc.selection[0];
          var gm = sel.geometricBounds;
          var os = sel.appliedObjectStyle;
          var curtf = sel;
          var curpage = sel.parent;
          var curStory = sel.parentStory;
               if(curpage.name ==doc.pages.lastItem().name) 
               else curpage = doc.pages.item(curpage.documentOffset+1);
               var temp = curpage.textFrames.add();
               curtf = temp;
               curtf.geometricBounds = gm;


          Use at your own risk, I don't think it works with facing pages.

          It will add frames to the following pages or add pages, the same size and position as the original, giving it the same object style.

          good luck

          1 person found this helpful
          • 2. Re: Autoflow a story
            CatalogCreator Level 1



            Thank you for the script. I appreciate your willingness to help me.


            Unfortunately, our catalog layouts are facing pages with offset left and right margins for odd/even pages (to allow additional room for the binding). I may be able to calculate the margin offset for each page and adjust accordingly. It appears a script needs to go through a lot of gyrations to simply autoflow a text block. This is in stark contrast to how easily it is done via the shift mouse click.


            Considering I am still a noob at OOP, adjusting your code to fit my needs is easier said than done. But it is always a good idea to learn something new, so I will persevere.


            Thank you again,



            ps: Adobe forum guidelines suggest users should let Adobe know if their products could be improved. In case anyone at Adobe reads this forum (I am beginning to wonder), I have this suggestion:


            While there are many things that InDesign does far better than PageMaker, in this one instance PageMaker is far superior. In PageMaker scripting you can open the Story Editor and build a chapter within the editor. My application does this via a DDE channel. The entire story is formatted within the editor via this channel. It's awesome. When complete, the script closes the editor and the cursor loads with autoflowable text. All I have to do is place the text at a single X,Y position. It autoflows and fills all pages until the story is done. Dead simple. It is very gratifying to watch dozens of pages being created this way. Sometimes it is close to 100 pages. What used to take us months to manually create, is now done in a few minutes.


            My company has been doing database publishing and creating catalogs with PageMaker since Adobe started working on InDesign version 1. Since PageMaker is a dead product, I decided it was time to replace my DDE commands with OLE equivalents. Some of the InDesign replacements are better than what I had to work with in PageMaker. Some are much better and have allowed me to skip some the gyrations PageMaker requires. But the lack of a similar method in InDesign for placing a completed story is disappointing.

            • 3. Re: Autoflow a story
              [Jongware] Most Valuable Participant

              You are right: scanning through the JS Help shows both file.place and file.xmlplace have an option 'autogrow'. One would expect the same somewhere for a Story object, as it has the same function in the user interface.


              Oh, and there are a few Adobe employees that read (and answer!) these forums, but I think if you put in a formal Feature Request (https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform) it ends up in some sort of database. I imagine they browse through that when looking for fresh ideas

              • 4. Re: Autoflow a story
                CatalogCreator Level 1

                Jongware, thank you for the suggestion and the link. It made it easy to offer my feature enhancement. Copy-and-paste. Done.



                • 5. Re: Autoflow a story
                  CatalogCreator Level 1

                  Until Adobe gets around to letting the story editor to create a story without first creating a text frame and then placing the autoflowable text at X,Y, here's another alternative that I find works pretty fast. My guess is it is much faster (and easier) than creating 100 pages of text frames until there is no more text to flow.


                  I created a 3-column template with 200 pages of empty, linked text blocks (Copy and paste a huge text file and manually flow the story to get your 200 pages of autoflow text frames. Delete the text.). Here is a some code you can adapt:


                  for x = 1 to 200
                  myPage = myDocument.Pages.Item(x)
                  myTextFrame = myPage.TextFrames.Item(3) 'the left most frame on the page
                  myContents = myTextFrame.Contents
                  if myContents = ""
                        myDocument.DocumentPreferences.PagesPerDocument = x-1 'delete all pages through the end of document

                  You could also save a bit of time by refining this routine to calculate the page number of where to start based on the quantity of text and images.


                  Hope someone finds this useful.



                  • 6. Re: Autoflow a story
                    Peter Kahrel Adobe Community Professional & MVP

                    In CS4 you can use Preferences > Type > Smart Text Reflow. When this is enabled and you place some text, it automatically flows.



                    • 7. Re: Autoflow a story
                      CatalogCreator Level 1

                      Thanks, Peter. If you could clarify a couple of questions, please.


                      Does CS4 require you to create a text frame before opening the story editor and then you can place the text via your script at position X,Y and have it Smart Text Reflow? If not, when you create the text frame and then create the story in the story editor, when you close the story editor does CS4 automatically reflow the text to fill the required number of pages?



                      • 8. Re: Autoflow a story
                        Peter Kahrel Adobe Community Professional & MVP

                        I never use the story editor, so I'm afraid that I can't answer that. Maybe InDesign's help can tell you more.

                        • 9. Re: Autoflow a story
                          CatalogCreator Level 1

                          I use CS2. No way to find out without purchasing CS4.

                          • 10. Re: Autoflow a story
                            Peter Kahrel Adobe Community Professional & MVP

                            Ah -- hadn't realised that. Well, maybe someone can enlighten you.

                            • 11. Re: Autoflow a story
                              Harbs. Level 6

                              I don't know what you mean by "opening the story editor". You can only 

                              open the story editor on an existing story. Stories can only exist if 

                              contained by a text frame.



                              • 12. Re: Autoflow a story
                                CatalogCreator Level 1

                                You can open the story editor if you first create an empty text frame. From there you can build the entire story within the story editor.


                                IMO, you should be able to build a story in the story editor without the requirement of needing a text frame first. ID should treat the story in the story editor the same as if you placed one of its importable file formats. For example, you don't need a text frame before you import a text file. In other words, create the story in the story editor and then place it at position X,Y with the autoflow property. It could be that simple.


                                PageMaker's story editor works that way. Only Adobe knows why they decided to make ID work differently. Considering the story editor was not even included in ID version 1, my guess is they never realized the usefulness of PageMaker's story editor. But as I said before, ID has many features that make my job of converting over to ID a pleasure. I give them kudos for that.

                                • 13. Re: Autoflow a story
                                  Harbs. Level 6

                                  I don't remember how PageMaker's story editor works. It's been many 

                                  years since we switched to InDesign 2.0... I actually just fired up an 

                                  old copy of PageMaker to see for myself, and sure enough, you can 

                                  create a new story without it being placed. When you try to close the 

                                  new story editor window, PageMaker asks if you want to place the text 

                                  and gives you a loaded cursor.


                                  When you place a story in InDesign, until you create a text frame, the 

                                  story is loaded into a loaded placement cursor. That's the only 

                                  instance that a story can exist without being contained by a text 

                                  frame. It does seem logical that stories must reside in at least one 

                                  text frame, otherwise managing them would be practically impossible. 

                                  PageMaker's way is a disaster waiting to happen if the document gets 

                                  closed unexpectedly... For better or for worse, that feature does not 

                                  exist in InDesign.


                                  When you create a blank text frame, you have in reality created a new 

                                  (empty) story.



                                  • 14. Re: Autoflow a story
                                    CatalogCreator Level 1

                                    Harbs, to see what I mean about the usefulness of the story editor, try this: Go ahead and fire up PageMaker again and open a new document. Now open the story editor. Type some some text in the story editor. Without closing the story editor save the document. Now quit PageMaker <Ctrl>Q. Notice it does not ask you if you want to place the story. (At least not if you have followed my directions correctly.)


                                    Now restart PageMaker and reopen your test document. It will open with the story editor and your text intact. You can now close the story editor and place the story. You have not lost anything. No disaster.

                                    • 15. Re: Autoflow a story
                                      Harbs. Level 6

                                      I hear what you mean, but I don't really see the value in it. I've 

                                      never felt the need to create a story without a containing text frame.


                                      If it's very important to you, you should file a feature request...



                                      • 16. Re: Autoflow a story
                                        CatalogCreator Level 1

                                        Harbs, I understand you came into this thread somewhat late. If you read the entire thread you will see your feature request suggestion was made by Jongware and I have already submitted my request.


                                        Anyway, this thread has veered off course. I never intended to turn it into a debate. My only intention for bringing it up was to show how the story editor is beneficial to the script writer in PMkr. The ID programmers have nothing to apologize for. Switching my database publishing application over to ID will be a pleasure.


                                        I found my answer. One that works well for my unique needs. Any further discussions of PMkr are somewhat moot at this point.


                                        Thanks to all,


                                        • 17. Re: Autoflow a story
                                          Harbs. Level 6

                                          You're probably right that I didn't read the whole thread well enough.


                                          Looking back at what you're after (if I understood you correctly), it 

                                          looks like you want to load a cursor with the text. You can do that 

                                          easily enough in InDesign (although it's somewhat more convoluted than 

                                          what you were doing in PageMaker).


                                          1. Create a story (in a text frame).

                                          2. Do what you need to it.

                                          3. Export to a temp file as tagged text.

                                          4. Remove the text frame.

                                          5. app.place(tempFIle) will then give you the text in a loaded cursor 

                                          which can be autoflowed.



                                          1 person found this helpful
                                          • 18. Re: Autoflow a story
                                            CatalogCreator Level 1

                                            Thanks, Harbs. I appreciate the suggestion. Ike