6 Replies Latest reply on Jan 9, 2011 8:18 AM by Jeffrey Dean

    SplitStory script seems to be broken

    Jeffrey Dean Level 1

      I am typesetting a book that needs to have separately numbered footnotes for each short section; they typically end in the middle of a page, so I might have the last footnote from one section in the upper part of the page and the first of the next in the lower part.

       

      Physically, I can get the result I want by inserting a blank 1-line split-column paragraph between the two sections, which forces the earlier note(s) to precede it. The problem is getting the numbering to start again from 1 in the new section. ID only allows section breaks at the top of a page, so I need to split the story repeatedly (potentially nearly 200 times in the whole book) whenever the section division comes in the middle of a page.

       

      I thought the SplitStory script would do the trick, but it doesn't seem to work. Whether I have an insertion point in the text or select the frame the text is in, the script fails with the error message "AppleScript Error!    Error Number: -2741    Error String: Expected "," or "}" but found identifier    Engine: Default    File: Applications/Adobe Creative Suite CS5/Adobe InDesign CS5/Scripts/Scripts Panel/Samples/AppleScript/SplitStory.applescript".

       

      Any advice?

        • 1. Re: SplitStory script seems to be broken
          sstanleyau Level 4

          The script works OK here. Try opening it in AppleScript Editor (choose Edit Script from the Scripts panel flyout menu) and run it from there -- then report which lie of the script the error is happening on.

          • 2. Re: SplitStory script seems to be broken
            Jeffrey Dean Level 1

            For some reason the faulty behavior has disappeared today. Yesterday, I restarted the computer at least once, but continued to get the same error; in AppleScript Editor the word "range" in the second line of the script proper (not counting the initial comments) was highlighted. The one major change in my system was upgrading Mac OS X to 10.6.6 overnight.

             

            Today the script works, but it turns out it isn't doing what I need: I hadn't quite understood from the descriptive comments that it separates every frame into a separate story (as well as wiping out all overset text, which I did get). What I need is to be able to split a story into two (no more) at a precise point in the text. If I have to make that point coincide with a break between two frames, I can live with that (though it would be a heck of a lot easier if I could simply position the text cursor at the point where I want to make the break). An even better solution, which I expect is unrealistic, would be to split the story at every occurrence of a particular paragraph style. (The sections I need to split up are of variable length, often covering multiple frames.)

             

            I have no expertise in scripting. Can you suggest a way to achieve what I'm after? Has anyone already produced a suitable script?

             

            Thanks,

            Jeff

            • 3. Re: SplitStory script seems to be broken
              sstanleyau Level 4

              You can't split a story mid-frame -- by definition, a frame can only contain one story. What a script could do is break the link between two text frames, and split the story between the two resulting text flows.

              • 4. Re: SplitStory script seems to be broken
                Jeffrey Dean Level 1

                Please be patient. I said I could live with that, but also that I have no expertise in scripting. So: I know that I need to manually ensure that the point where I want to split is at the end of a frame. Please advise me how to

                break the link between two text frames, and split the story between the two resulting text flows

                because I don't know how to achieve this, either by hand or by scripting.

                • 5. Re: SplitStory script seems to be broken
                  sstanleyau Level 4

                  OK, suppose you have the cursor somewhere in some text in a frame. When you run the following script, all text beyond the selected insertion point will moved to the following frame, and the link between the two frames will be broken:

                   

                  tell application "Adobe InDesign CS5"

                  set theSel to item 1 of selection

                  set theOffset to index of theSel

                  set theStory to parent story of theSel

                  set theFrame to item 1 of (parent text frames of theSel)

                  set nextFrame to next text frame of theFrame

                  set next text frame of theFrame to nothing

                  set parent story of nextFrame to ""

                  move (text from character theOffset to character -1 of theStory) to after parent story of nextFrame

                  end tell

                  1 person found this helpful
                  • 6. Re: SplitStory script seems to be broken
                    Jeffrey Dean Level 1

                    Many thanks, Shane. However, the script as given breaks down at line 8 with the result "error "Adobe InDesign CS5 got an error: 'parent story' is a read only property." number 30474". What actually occurs is that the link between the current frame and the next is broken, but the text has not been moved -- it is now overset from the current frame. A little experimentation has shown that that line needs to be:

                     

                    set contents of parent story of nextFrame to ""

                     

                    and the script now works as advertised. For any future readers of this thread, I offer a screen shot:

                    Screen shot 2011-01-09 at 16.15.11.png

                     

                    Message was edited by: Jeffrey Dean