1

Is there a way to break a story by selecting a text frame and split it in two? There is two scripts which they called and do as:

BreakFrame (shipped by application and is in the sample): This scripts job is to break and dismember a selected text frame from a series of threaded frames (which they have one story).

SplitStory (shipped by application and is in the sample): This scripts job is to split apart a series of threaded text frames into individual frames.

Also there is a very useful plugin called TextStitch which is free, but it needs to be run under another plugin that called APID ToolAssistant and its not free!

Is there any free script, or anybody can write a new one (with options of break before or after could be even greater) to do like this image?

enter image description here

  • How will the script know where to break? What are the criteria? – Janus Bahs Jacquet Mar 8 '18 at 7:47
  • 1
    @JanusBahsJacquet dunno it seems to me that the criteria is pretty straightforward on the picture. Kill the text link and let the boxes stray the same. I can also see why its not free... Because it clearly has some added value. – joojaa Mar 8 '18 at 8:02
  • @joojaa Yes, but between which text boxes? Every third? When the following box is further to the left than the current? When there’s a manually inserted frame break? Some other criterion? It doesn’t seem clear to me at all. – Janus Bahs Jacquet Mar 8 '18 at 8:06
  • @JanusBahsJacquet i imagine ultimately the user would want this to happen when he click on the text thread line. – joojaa Mar 8 '18 at 8:17
  • 3
    Are you looking for a script like this? jsid.blogspot.com/2005/08/… – SZCZERZO KŁY Mar 8 '18 at 9:11
1

Thanks to user "SZCZERZO KŁY" introduced "Dave saunders" script, it looks work fine but for those who think the script no longer works, it continues to run perfectly for me right up to CC 2015 by putting it into a "Version 4.0 Scripts" (case sensitive but without the quotes) subfolder of the Scripts Panel folder.

//DESCRIPTION: Splits story at the selected text frame.

// The selected frame becomes the first of the new story. 
// Note that the behavior when an overset last frame is selected 
// is different from that of the break-out text frame script. 
// This script moves the overset text to the second story while 
// breaking out the last frame leaves the overset text attached to the first story.

if ((app.documents.length != 0) && (app.selection.length != 0)) {
 var myFrame = app.selection[0];
 if (myFrame.constructor.name != "TextFrame") {
  errorExit('Please select a text frame');
 }
 var myStory = myFrame.parentStory;
 var mySplit = myFrame.textFrameIndex;
 var myTot = myStory.textFrames.length;

 // Because of the possibility of tables, we must always work from the back
 var myStart = myTot - 1;
 var myEnd = mySplit;

 // Nothing to do if user has selected first frame.
 if (myEnd != 0) {
  if (myStart > myEnd) {
   var myPrevFrame = splitMe(myStory.textFrames[myStart]);
   myStart--;
   for (var i = myStart; i> myEnd; i--) {
    var myNewFrame = splitMe(myStory.textFrames[i]);
    myPrevFrame.previousTextFrame = myNewFrame;
    myPrevFrame = myNewFrame;
   }
  }
  // Now we deal with the last frame
  myFrame = myStory.textFrames[myEnd]
  try {
   myIndex = myFrame.characters[0].index;
   stEnd = myStory.length - 1;
   myText = myStory.texts[0].characters.itemByRange(myIndex,stEnd);
  } catch (e) { } // Ignore; happens if last character is a table or frames are empty.
  myNewFrame = myFrame.duplicate();
  try{myText.remove();}catch(e){} //ignore empty frame
  myFrame.remove();
  try{myPrevFrame.previousTextFrame = myNewFrame;}catch(e){} //fails if one frame only
  //Finally, if, and only if, the split is mid-table, myStory is now overset
  if (myStory.textFrames[-1].overflows) {
   myTable = myStory.characters[-1].tables[0];
   myNewTable = myNewFrame.parentStory.characters[0].tables[0];
   myRowCount = myNewTable.rows.length;
   myTable.rows.itemByRange(0 - myRowCount,-1).remove();
  }
 }
} else {
 errorExit();
}

// +++++++ Functions Start Here +++++++++++++++++++++++

function splitMe(myFrame) {
 myDupeFrame = myFrame.duplicate();
 while(myDupeFrame.contents.length > 0) {
  myDupeFrame.texts[0].remove();
 }
 myFrame.remove();
 return myDupeFrame;
}

function errorExit(message) {
 if (arguments.length > 0) {
  if (app.version != 3) { beep() } // CS2 includes beep() function.
  alert(message);
 }
 exit(); // CS exits with a beep; CS2 exits silently.
}
// +++++++ Script Ends Here ++++++++++++++++++++++++++

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.