I didn't know that a text frame can have an anchored object! In fact, I
The parent of an anchored object is an insertionPoint. So try,
myAnchoredObject = myInsertionPoint.textFrames.add();
Thanks, but i need to insert an existing group as anchored object.
This script doesn't work :
txtfrm.InsertionPoints.LastItem.Groups.Add tItems, Nothing, idAtBeginning
txtfrm is the container.
tItems is an array of pageItems.
@Aljn – the method insertAnchoredObject() for anchoredObjectSettings was introduced with InDesign CS5.5. So, no chance to use it with InDesign CS5.
Instead you can select the group, cut it, select the insertionPoint where you want to anchor it, paste it and then set all relevant anchoredObjectSettings.
I'm talking ExendScript here, you might be working on a VB Script. But this alternative solution ( to insertAnchoredObject() ) should also work in VB (at least I hope that…).
app.select(null); myDocument.select(myGroup); app.cut(); app.select(myInsertionPoint); app.paste();
All variables with my at the beginning should be defined before.
@Uwe: He says in the first post that InDesign server can't work with cut
and paste. I wonder if that means your script won't work on ID server.
If not, it's a very good question – how can you insert an anchored
object in ID Server CS5? Perhaps the item simply has to be rebuilt from
Ah, yes. app.cut() and working with selections would not work in InDesign Server. Sorry.
No chance then. No chance other than to recreate the objects you want to anchor with the add() method.
But for a Group object that seems to be impossible.
I shudder in advance to suggest this, but the next "best" thing (it's an ugly workaround) for re-creating a group is to adding a rectangle at an insertionPoint. And then to add() all (in fact: recreate) the objects of the existing group to that rectangle. But this could be very hard to impossible.
Hm. Maybe upgrading to InDesign Server CS6 would be the better idea…
What's $20,000 dollars between friends...
Hm, what would cost about four to five InDesign CS6 desktop licenses and three to four people working the desktop versions 24/365 clicking some scripts now and then? ;-)
Okay ! Thank you everyone.
The customer changed his mind and he has decided to update to CS6.
So issue resolved !