Copy link to clipboard
Copied
In the sample Adobe script for InDesign, SplitStory.jsx, there is a note: "Any overset text at the end of the story will be deleted."
This seems to be not true, at least in the most recent versions of InDesign (I tried it on InD 19.5.4 and 20.4.1, on Windows 11): the "duplicate" method of the TextFrame class copies also the overset text in the duplicated frame.
The sample script is from 2009, so I guess that sometime between there and now the application's behavior changed. Do you know the InDesign version when this happened, or where to find this information?
I tried to look for the release notes of the old versions of the program, but the links in this page (https://helpx.adobe.com/indesign/indesign-releasenotes.html) are all redirected to the release notes of the latest version.
Copy link to clipboard
Copied
That might be difficult to find out, and likely impossible from just reading release notes because tiny scripting API changes are *very* unlikely to have been included, especially back then. You would have to check each version that you could get your hands on (and get running succesfully!).
Hypothetically, if we decided that checking each version was not worth the effort, is there something we can do to help? Do you need the split story script to remove overset text? That is easy to do. I have written my own Split Story 2 script which has some advantages (mainly that you can undo it in one go!)
- Mark
/**
* @File SplitStory2.js
*
* Splits the selected story into separate (i.e., unthreaded) text frames.
* To use this script, select a text frame or some text, then run the script.
* @author m1b
* @version 2025-07-16
* @discussion https://community.adobe.com/t5/indesign-discussions/since-which-version-of-indesign-the-textframe-duplicate-method-copies-overset-text/m-p/15416461
*/
function main() {
var settings = {
// whether to remove overset text from the split frames
removeOversetText: true,
showResult: true,
};
if (
0 === app.documents.length
|| 0 === app.activeDocument.selection.length
|| !app.activeDocument.selection[0].hasOwnProperty('texts')
)
return alert('Please select some text and try again.');
var doc = app.activeDocument;
var story = doc.selection[0].texts[0].parentStory;
var frames = story.textContainers;
for (var i = frames.length - 1, newFrame; i >= 0; i--) {
newFrame = frames[i].duplicate();
if (
settings.removeOversetText
&& newFrame.texts[0].parentStory.length > newFrame.characters.length
)
// remove overset text
newFrame.characters
.itemByRange(newFrame.characters.lastItem(), newFrame.texts[0].parentStory.characters.lastItem())
.remove();
// remove the original threaded frame
frames[i].remove();
}
if (settings.showResult)
alert('Split story into ' + frames.length + ' frames.\nBe aware that this may interfere with paragraph numbering.');
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Split Story');
Copy link to clipboard
Copied
Hi Mark, thank you for the answer and the code!
I just wanted to know when the behavior changed to be able to handle both approaches in one script by checking the InDesign version (or just to be sure that all the recent versions, say at least those of the last 5-6 years, already follow the new behavior). Maybe, instead of checking the InDesign version, the script could create a dummy story with an overflow in the document to check the functionality before splitting the stories...
Copy link to clipboard
Copied
Ah okay. Out of curiosity, what will your script do when it knows which way that version of indesign performs? I mean it's easy to just check it, as I do in my script aboveāI compare the number of characters in the story to the number of characters in the text frame (of the last duplicated frame). If they are the same, then Indesign behaved "in the old way", otherwise it performed the way it does now. Then what do you do with that info? Or are you writing documentation and just need to know?
- Mark
Copy link to clipboard
Copied
Basically, the script splits all the stories in the document, but only between different pages (i.e. multiple frames of a story in the same page are kept together), and only if the story is longer than n characters. The overset text should be preserved. If it's not, I would add a new frame at the end of the story. You're right that a check on this functionality should be easily achievable, thanks!
Copy link to clipboard
Copied
So you want the split story script to add a new text frame if there is overset text?
Copy link to clipboard
Copied
Yes, but only if the overset text would be deleted while splitting. Actually, the new frame is not strictly necessary, only the text is important: it would be probably easier to just copy the overset text at the end of the duplicated frame before deleting the original one.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now