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.

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.

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.

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.

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 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.
Comments
Jean-Claude Tremblay wrote:
Hi Thomas, This script is fabulous! Thanks for sharing it with us.
Silkjaer wrote:
You are very welcome :)
Jesper wrote:
Hej Thomas
Jeg kan ikke få det til at virke. Anchoret flyver i bedste fald rundt uden logisk kontrol?
Mvh
Jesper
Silkjaer wrote:
Jesper: Kan du give et eksempel? Virker fint i mine tests. Hvilken version af InDesign, hvilket styresystem?
Michel Vrana wrote:
This script is great! Is there a way to have it act just on the selected story, rather than the whole document?
Silkjaer wrote:
Michel: Thanks! That should not be a problem - I'll put it on my todo list for script updates :)
Vicki wrote:
You just made my life so much easier! Thank you so much for sharing your hard work.
Chris wrote:
Hi, I want to use your script with CS4 Windows. But there is allways an error: no.30480 - There are no data for the type in line 128.
Do you have an idea what is wrong? Do you have an example document?
Thanks.
Hussein wrote:
I have no trouble with this script on cs4
Anja wrote:
Hi, I have a Problem with this script. I work with MAC an CS4. I do everything like instructed and when I want to confirm in the end, there is always a error message
"JavaScript Error!
Error-Nr. 30480
There are no data of the requested type available"
Can you help me please, this is very urgent.
Thank you
Anja
Write a comment!