If you often create books with text in the margin, you probably know the importance of being able to use anchored objects. The only downside to anchored objects are creating them - especially if it is a large book with a lot of text needed to be moved.

I have written a script to help in this process. In short, it does all the hard work for you.

You can easily just download the script, run it, and you will probably quickly figure it out, but I still want to explain how I found the workflow easiest.

The workflow

First of all, you have to ensure that the text you need moved to anchored text frames are marked up using either a character style or a paragraph style.

Text with paragraphs marked up as margin text.

Text with paragraphs marked up as margin text

The second thing you should prepare, is an object style for the anchored text frames. By creating an object style you can easily change all locations of the frames at a later point, the look etc.

The Anchored Object Options.

The Anchored Object Options

It is also a good idea to specify a paragraph style in the object style, if you would like it to be another than the referring text.

You can specify a paragraph style for your text frame.

You can specify a paragraph style for your text frame

The third thing you have to find out, is what the height and width of the anchored frame should be. You have to type in these values when the script is executed. The values can be typed in as any unit, InDesign will automatically convert it to millimeters.

The scripts main window where the options is set.

The scripts main window where the options is set

When the script is executed, you will have the option to either find and move character styles or paragraph styles to anchored text frames. The option to delete matches gives you the choice of leaving the "moved" text in the main text flow.

For character styles, the anchor will be placed after the text, in the beginning of the following word. For paragraphs, the anchor will be placed as the first thing in the next paragraph.

The final result in this case.

The final result in this case

The script

The AppleScriptJavaScript can be downloaded here: create_anchored_frames.jsx.

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.