Last active
August 29, 2015 14:06
-
-
Save dvschultz/e760cb048357bd859351 to your computer and use it in GitHub Desktop.
story splitter that skips modal and assumes you want split before :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
---------------------------------------------------------------------- -------------------------------------------- | |
StorySplitter | |
---------------------------------------------------------------------- -------------------------------------------- | |
An InDesign CS/CS2/CS3 JavaScript by FourAces | |
© The Final Touch 2006 | |
Version 3.0.0 | |
Splits the selected Story to separate Text Frames, while maintaining their contents. | |
---------------------------------------------------------------------- -------------------------------------------- | |
Update by Naomi Kennedy | |
*/ | |
#targetengine "session" | |
app.scriptPreferences.enableRedraw = 0; | |
var myScriptVer = "3.0"; | |
if(app.documents.length != 0){ | |
mySplitBefore(); | |
}else{ | |
alert("No Active Document Found.\nPlease open an InDesign document and select a Story to split."); | |
} | |
//-------------------------------------------------------------------- -------- | |
function mySplitBefore(){ | |
var mySelection = app.activeDocument.selection; | |
if(mySelection[0].previousTextFrame == null){ | |
alert("Unable to break thread.\nThe selected Text Frame is the FIRST text frame of the thread."); | |
} | |
else{ | |
var myBfBreakFrame = mySelection[0].previousTextFrame; | |
var myAfBreakFrame = mySelection[0]; | |
var myBreakStory = myBfBreakFrame.parentStory; | |
mySelection[0].previousTextFrame = null; | |
if(myBfBreakFrame.overflows == true){ | |
var myOversetText = myBreakStory.texts.itemByRange(myBfBreakFrame.insertionPoints[-1],myBreakStory.insertionPoints[-1]); | |
myOversetText.select(); | |
app.cut(); | |
app.select(myAfBreakFrame.insertionPoints[0]); | |
app.paste(); | |
app.select(myAfBreakFrame.insertionPoints[0]); | |
app.menuActions.itemByID(118822).invoke(); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment