Merge TextFrames Extension for Adobe InDesign

Justin | ExtendScript,extensions,InDesign | Friday, November 28th, 2008

By request—following similar extensions for Flash and Illustrator—here’s an extension for InDesign that merges multiple textframes into one, while retaining the original styles. Because of properties within InDesign, this extension is actually the most powerful of the three. It accepts characters in the separator field for hard returns, soft returns, and tabs (as well as any combination of any other standard characters). There are also options in the dialog box that control the size of the textframe once it’s been merged (see the variations in the graphic down the page).

I used David Van Brink’s Omino Dialog Maker code again for the dialog box in this extension.

download and instructions below the fold…

Download

Installation

JSX or JS file:

  1. Place the MergeTextframes_ID.jsx into the Scripts Panel directory within your InDesign application directory:

Script Panel directory:
CS3 or newer > {application directory**}/Scripts/Scripts Panel
CS/CS2 > {application directory**}/Presets/Scripts/Scripts Panel

**Application Directories:
Windows > C:\Program Files\Adobe\Adobe InDesign {version}\
Mac OS X > Applications/Adobe InDesign {version}/

MXP file (CS4 or later):

  1. Double-click on the MXP (or ZXP) file to install using Adobe Extension Manager that matches your target version of InDesign. With the ZXP, you may receive a warning that the extension is unsigned, but it is safe to install.

Usage

Select the textframes you want to merge in InDesign.

Open the scripts panel, Windows > Utilities (or Automation pre-CS5) > Scripts.

Locate the MergeTextframes_ID.jsx script in the Scripts Panel and double-click to run the script. If you installed the script using the MXP file, the script with be in the Ajar Productions subfolder. If you’re running InDesign CS3 or newer you will be prompted with a dialog box. The dialog box will allow you to select the orientation of the sorting (top, left, bottom, right), use a custom separator character(s), and select options to fit the merged textframe once complete.

Note: This file has not been tested on CS or CS2, as neither of the two were working on my machine for some reason. In CS/CS2, you will not be prompted with a dialog; the script will run using the default settings sorting topmost, then leftmost, with a separator of “[><]“ and no fitting options selected. You can then run a Find and Replace and replace the separator with the characters of your choice. This script will likely run in CS(1), but you may have to change the file extension from .jsx to .js.

Update (3/02/2010):
Version 1.1.0 now has the ability to batch-merge textframes within every page of the current document. I had several requests for something like this (including from a recent donor). Here it is! The download links above have been updated.

The new version now has the “Apply to” and “Ignore locked layers” as shown in the image below.

Merge Textframes version 1.1.0 new features

Note that any warning messages about having too few textframes selected have been delayed until after the dialog box appears to reflect the new options.

Thanks for visiting this page and using our extension!

Before you go, grab another free InDesign extension

The Split Text extension will save you time by easily breaking text into smaller pieces.

More info on Split Text.

Related Articles

116 thoughts on “Merge TextFrames Extension for Adobe InDesign”

  1. ariyamuthu says:

    Nice… Thanks

  2. Rachel says:

    Hi Justin,
    This script is just what I have been looking for. Unfortunately, I am unable to make it work how I’d like. When I run the script I get the following error:

    JavaScript Error!
    Error Number: 30614
    Error String: Invalid object for this request.
    Engine: main
    Line: 537
    Source: arr[i].previousTextFrame = arr[i-1];

    I am trying to run the script across multiple pages of text boxes using the “all pages” feature, but the script will only combine 1 page of text boxes at a time. (I get the error but the script does actually do its job for one page.) Subsequent pages can also be done, but each page saves into its own separate text box. I have dozens of pages so this is somewhat helpful but I was hoping to wind up with one single text box with text from every single page. Can you help!!?? I am running CS6 on Windows 7

    1. Justin says:

      Hi Rachel,
      If you’d like to email us a small INDD file that replicates the issue, we can take a look.
      support (at) ajarproductions (dot) com.

      1. Steven says:

        It seems I can reproduce this error when trying to merge threaded text frames. So perhaps unthread them first before merging text boxes.

      2. Justin says:

        Thanks, Steven. We’ve found this too and we’re investigating. In the meantime, there is a sample script installed with InDesign the will unthread text frames. Running that first may do the trick.

  3. Steven says:

    I’m also having this issue.

  4. dan says:

    same here, CS6, not seeing an error, but it’s only merging boxes on one page, not all pages as hoped.

  5. dan says:

    Is that how it’s intended? Batch merging each individual page per page? Was hoping to be able to merge all text into one long text box.

    1. Justin says:

      Hi Dan and Steven,
      Are any of your text frames linked?

      1. Dan says:

        No, this was just a test document, I made 3 separate text boxes, 1 on the first page, 2 on the second, and when I run the script it merges the two on the second page but leaves the first.

      2. Justin says:

        Ah, that is how it’s supposed to work. It merges all the text frames on each page, but does not merge across pages. So, if you had 2 text frames on the 2nd page, those would be merged together, but would not be moved to the 1st page.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>