9 Replies Latest reply on May 9, 2016 11:00 AM by micheller81371267

    breaking thread


      Has anyone created a script for breaking links between threaded text frames whilst preserving placement of text?
        • 1. Re: breaking thread
          Level 1

          Yes--I think I've posted this before, but here it is again (this is the VB version):

          Rem Break selected story into separate text frames.
          Dim myInDesign As InDesign.Application
          Dim myStory As InDesign.Story
          Set myInDesign = CreateObject("InDesign.Application.2.0")
          Set mySelection = myInDesign.Selection
          Set myTextFrame = mySelection.Item(1)
          Set myStory = myTextFrame.ParentStory
          Rem Duplicate each frame and tag the frame with an unique label.
          For myTextFrameCounter = 1 To myStory.TextFrames.Count
              Set myNewTextFrame = myStory.TextFrames.Item(myTextFrameCounter).Duplicate
              myTextFrameLabel = "StoryID:" & CStr(myStory.ID) & ":TextFrameIndex:" & CStr(myTextFrameCounter) & ":TextFrameCount:" & CStr(myStory.TextFrames.Count)
              myNewTextFrame.Label = myTextFrameLabel
          Rem Now delete all of the text frames in the original story (scary!).
          For myTextFrameCounter = myStory.TextFrames.Count To 1 Step -1
          MsgBox "Done!"


          • 2. Re: breaking thread
            spancilhill Level 1

            Thanks for your prompt reply. I am inexperienced in the scripting department: tell me, what is the 'VB version'.

            Please excuse my ignorance.
            • 3. Re: breaking thread

              VB is for Visual Basic = Windows. AS is AppleScript = Apple.


              • 4. Re: breaking thread
                spancilhill Level 1
                Ah, we Mac users...
                • 5. Re: breaking thread
                  Level 1

                  Here's an AppleScript version:

                  --An InDesign 2.0 script
                  --Splits the selected story into unlinked text frames (while
                  --reataining text frame content). To use this script, select
                  --some text or a text frame, then run the script. This script
                  --does nothing when you select text in a table cell.
                  tell application "InDesign 2.0.1"
                  set myTextObjects to {insertion point, character, word, line, text style range, text, paragraph, text column}
                  set mySelection to selection
                  if (count mySelection) > 0 then
                    get class of item 1 of mySelection
                    if class of item 1 of mySelection is in myTextObjects then
                     --Use the parent story of the first insertion point; selections can span multiple text frames.
                     set myStory to parent story of parent text frame of insertion point 1 of item 1 of mySelection
                     set mySplitStory to true
                    else if class of item 1 of mySelection is text frame then
                     set myStory to parent story of item 1 of mySelection
                     set mySplitStory to true
                     set mySplitStory to false
                    end if
                    if mySplitStory is true then
                     duplicate text frames of myStory
                     delete text frames of myStory
                    end if
                  end if
                  end tell

                  Copy this script out of the message, then paste it into the Apple Script Editor. Select a frame in a threaded story, then run the script from the Script Editor. If it works, save it as a compiled script (one of the Script Editor's save options). If you save the compiled script (or an alias to it) in the Scripts folder in your InDesign application folder, you'll be able to run the script from the Scripts palette in InDesign (which is much easier and faster than running the script from the Script Editor or from the Finder).


                  • 6. Re: breaking thread
                    spancilhill Level 1

                    A million thanks.

                    I'll give the script a whirl and report back.
                    • 7. Re: breaking thread

                      Hello, I'm looking for a script where I can separate a table from a text frame by selection. Do you have this script by any chance?



                      Thank you!


                      • 8. Re: breaking thread
                        Laubender Adobe Community Professional & MVP

                        Hm. Did you realize that you added this comment to a 13 year old thread?

                        Michelle, please start a new thread for your question.



                        • 9. Re: breaking thread
                          micheller81371267 Level 1

                          Sorry, I didn't know this thread was 13 yrs ago. I started a new thread.