Disclaimer: I am new to Indesign scripting, please bear with me

I am looking for a marker" in a text, enclosed in brackets. I use grep for this, as I don't know the length of my marker

app.findGrepPreferences.findWhat = "\\\[\\\[.+\\\]\\\]";

After finding the marker I would like to place an image, depending on the content of the marker, at its position inline, with a different image every time. This I know how to do, if I wish to have it at the end of the text

myRect = myDocument.rectangles.add();
myRect.place(new File("/c/someimage.png"), false);
myRect.anchoredObjectSettings.insertAnchoredObject(myTextFrame.parentStory.insertionPoints.item(-1), AnchorPosition.INLINE_POSITION);

Now how do I get the image to live instead of my marker? The main focus of my question ist the positioning of the rectangle

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.