As I wrote about back in march I was wishing for inline text boxes. Boxes flowing with the text, that also should be able to "break" across text columns etc.
To fulfill my wish I wrote a small script, creating a more flexible workaround. Other workarounds was also mentioned in the old article, but this is an automated alternative to another manual approach, drawing a frame behind the given text.
An example of the automatic result.

How the frame is supposed to look is defined by an object style, but furthermore it allows you to add a padding around the the box, so you are not limited by the text frame the text is in.
To make sure the frame is placed behind the text, they are all put in their own layer.
The layer palette with the required layer.

The script also allows you to have more than one kind of box texts, you just have to set up your document correctly. For it to work it will need the following:
- A layer with the name "Boxes" placed lower than the text
- For each text box style, an object style named like "Box: Blue boxes"
- A paragraph style with the same name as the object style, but without the "Box: " prefix
For an example of this setup, please download the sample document from this page.
Paragraphs and object styles.

The object style you define are applied to the boxes, this allows you to define e.g. fill color, transparency, strokes etc.
To add a padding to the box, define an inset spacing in the the object styles Text Frame General OptionsCrop Amount in Frame Fitting Options.
Defining the padding as Crop Amount

When you run the script, the boxes will be added behind all the text marked up with one of your box text paragraph styles, but please note that they will not "follow" the text as you type. Don't worry though, you can always run the script again, and it will rearrange the boxes.
The script
The JavaScript can be downloaded here: automatic_text_boxes_1.1.zip.
You can add it to your Scripts palette and run it from there. To do that, place the file inside the "~/Library/Preferences/Adobe InDesign/Version 6.0/Scripts/Scripts Panel" folder.
Changelog
1.1: Added support for "negative padding" - making the boxes smaller than the width of the column.
