This is something that has bugged me often with InDesign. Although InDesign has a way of setting an object style to be “default” (in the object styles panel just drag the [T] to your preferred default style), that default setting very often does not seem to “catch”.

In the simplest case it works. That is, when creating a new text frame on the page by dragging one out with the type tool, that new frame’s object style will be the default text frame object style.

But in many cases InDesign just doesn’t seem to respect the setting. I haven’t analyzed exactly when it works and when it doesn’t, and I don’t want to write inaccurate information here, so suffice it to say that I frequently find that text frames over many pages either have the wrong style, or the None style, but not the style I would have wanted. (I think this will often happen when autoflowing text, for instance.)

Now, in later versions of InDesign, including CS6, the find/change dialog has an Object tab. Under the object tab it is possible to find and replace object styles, and even to limit that find/change operation to text frames only.

However, what if you already have many text frames in a document with the correct style applied? You can’t do a global change in such a case to apply the text frame style you would like, because this will override cases where the “wrong” style is correctly applied to certain other text frames.

Moreover, there is no way to set the Object find/change to search “to the end of the story”, as you can with a Text search or a GREP search in InDesign.

In short, this calls for a simple script (I call a script simple if it has no UI and does not require more than a single loop). So I would like to share the following script which I threw together to deal with this problem.

Instructions

  1. Select a threaded text frame.
  2. Run the script.
  3. Click OK if you’re happy with what’s going to happen.

What it does: The script will apply the object style of the selected text frame to all the text containers (text frames and text on a path) in the story from that point on.

For example: You have an InDesign document with 10 pages and 10 threaded text frames constituting a single InDesign story, one frame per page. Page 5 has a text frame with an applied object style called “MainFrame”. If you select the frame on page 5 and run the script, the script will apply the style “MainFrame” to the text frames on pages 6 through 10.

To use the script, copy it into a text editor, save with a .jsx extension, and copy into InDesign’s Script folder.

Enjoy!

mySelection = app.selection[0];
if (! mySelection instanceof TextFrame){
   alert("Please select a text frame and try again.");
exit();
}
myObjectStyle = mySelection.appliedObjectStyle;
myResult = confirm("Apply object style " + myObjectStyle.name + " to all threaded frames until the end of the story?");
if (!myResult){
   exit();
}
myCounter = 0;
while (mySelection = mySelection.nextTextFrame){
   myCounter++;
   mySelection.applyObjectStyle(myObjectStyle, true, true);
}
alert("Number of text containers affected: " + myCounter);