i am currently triing to write a script that loops all (not anchored) graphics within a document. I want to anchor the image because i want them to move along with the text.
Here are the steps i took so far:
1. Iterating through graphics using "myDocument.allGraphics"
2. Check if "myGraphic.parent.parent.constructor.name" is Character or Page. If it is character the image is already anchored.
3. Iterate through all text frames on the page of the current image and
determine one frame that overlaps the Rectangle of the image.
4. Determine the everage height of a line of the frame (Heigh of frame / number of lines)
5. Determine the line number of the insertion point for the graphic (=iLine)
6. Determine the average number of characters per line (=averageChars)
7. Calculate the average width of a chracter (width if text frame / average number of chars per line)
8. Calculate the number of characters for the indention (horicontal) of the graphic (=iChars)
9. Insert graphic as follows:
var myNewGraphic = matchingFrame.insertionPoints.item(iChars + iLines * averageChars).place(file, false);
10. Delete the original graphic and it´s rectangle
My problems are as follows:
1. The insertion position of the image is never correct even though the calculated line number (iLines) and the calculated indention (iChars) is correct.
2. After insertion of the image the text does not flow correctly around the contures of the image
3. I dont know how to set the options for anchored objects as listed in (Objekt -> Verankertes Objekt -> Optionen IN GERMAN VERSION OF INDESIGN)
Thanks everybody. If the source code is needed i will provide it.
I'd love to help with this script, because I need to do this very thing myself. Would you be willing to post the script or send to thomas [at-symbol] eload24.com? It would really save me a lot of time, thanks!