Skip to main content
Participant
July 16, 2025
Question

Since which version of InDesign the TextFrame duplicate method copies overset text?

  • July 16, 2025
  • 1 reply
  • 365 views

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.

1 reply

m1b
Community Expert
Community Expert
July 16, 2025

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.
 * @7111211 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');
framlbjAuthor
Participant
July 16, 2025

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

m1b
Community Expert
Community Expert
July 16, 2025

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