Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jul 15, 2025 Jul 15, 2025

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.

TOPICS
Scripting
275
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 15, 2025 Jul 15, 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.
 * @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');
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 16, 2025 Jul 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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2025 Jul 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 17, 2025 Jul 17, 2025

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2025 Jul 18, 2025

So you want the split story script to add a new text frame if there is overset text?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2025 Jul 18, 2025
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines