Hi all
How to select group's anchor point and anchor it to document's insertion point in indesign cs5.5 using javascript or vb.net
You can't add a group as an anchored object as you would with, say, a rectangle—with insertionPoint.rectangles.add(); there is no insertionPoint.groups.add(). If you're working with InDesign desktop, you can select the group, cut or copy it, select the insertionPoint, and paste. Then do group.anchoredObjectSettings.properties = {anchoredPosition: AnchorPosition.ANCHORED, pinPosition: false}, then group.move() to your absolute coordinates.
If you're working with InDesign Server and don't have select, copy or paste, you'll have to do some acrobatics with snippets or libraries to get your group anchored. It's been covered here somewhere before...
Jeff
You need to get a reference to your group -- let's call it myGroup -- and another to the insertionPoint where you want it anchored -- let's call it myIP. Given those, you can achieve your objective (in CS5 or later) by:
myGroup.anchoredObjectSettings.insertAnchoredObject(myIP);
You can specify a second parameter if you wish that specifies the anchor position:
myGroup.anchoredObjectSettings.insertAnchoredObject(myIP, AnchorPosition.anchored);
That should get you started.
Dave
try this below code, make grouped object on the document first page then place the insertionPoint at any textframe. and run this below code.
var myIP = app.selection[0].insertionPoints[0];
app.activeDocument.pages.firstItem().groups[0].anchoredObjectSettings. insertAnchoredObject(myIP);
I hope this will helps to you.
@EyenanC – I just tested with InDesign CS5.5 7.5.3. The script is running without error.
I used the code of கற்பனை (Imagine), What you need is a text frame and a group on page 1 of your document. Select the text frame and run the script: the group will be anchored to the first insertion point of your selected text frame.
@Dave Saunders – thank you so much for pointing us to that capability of InDesign CS5.5 scripting DOM!
Uwe
North America
Europe, Middle East and Africa
Asia Pacific