Mobile app version of vmapp.org
Login or Join
Martha945

: InDesign: How break a story from a text frame in two part? Any Scripts? 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

@Martha945

Posted in: #AdobeIndesign #IndesignScripting #Text

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Martha945

1 Comments

Sorted by latest first Latest Oldest Best

 

@Lengel450

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 ++++++++++++++++++++++++++

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme