1 Reply Latest reply on Jul 23, 2009 3:30 PM by [Jongware]

    VB(CS4): Select Stories one at a time through the document

    Girard Andrew

      Can someone help me select stories one at a time through the document.

       

      Somewhat like...

       

      For i = 1 to myInDesign.ActiveDocument.Stories.Count

           myInDesign.ActiveDocument.Stories(i).Select

      Next i

       

      But that is not the right code of course. Thanks.

        • 1. Re: VB(CS4): Select Stories one at a time through the document
          [Jongware] Most Valuable Participant
          ..that is not the right code of course..

           

          It is not? I'm not used to VB, but it looks like it does what you want: select each story, one by one.

           

          "Selecting" something has the same limitations in the scripting engines as it has in InDesign itself, so you cannot select text in more than one story. That might be the reason you think the code doesn't work.

           

          On the other hand, with scripting you don't have to physically "select" anything to work on! In fact, even if you have some text selected, running

           

          myInDesign.ActiveDocument.Stories(1).ChangeCase (ChangecaseMode.UPPERCASE) ' made up example, not sure of syntax

           

          will change the case of all the text in that story, not just that of the selection. And that selection may even be in an entirely other story ...

          (I have a single script -- that I know of -- that runs on a certain selected piece of text, and keeps on running on that original selection even when I select something else! How's that for scripting power?)

           

          So, the question is, what do you want to do with all stories? It's probably easier to "do" that directly, without using Select.