Skip to main content
Mnietek1
Inspiring
August 4, 2016
Question

how to duplicate frame content to another frame

  • August 4, 2016
  • 3 replies
  • 3908 views

I'd like to duplicate content of one frame to another frame. Content is not a text. It could be a graphic or group of objects.

Is this possible?

This topic has been closed for replies.

3 replies

Community Expert
August 5, 2016

Mnietek1 wrote:

I'd like to duplicate content of one frame to another frame. …

What kind of frames are you talking about?

Source frame:

Graphic frame with nested objects?

Text frame with anchored objects?


Target frame:

Graphic frame with/without no nested objects?
Text frame with/without anchored objects?

Something else?

Regards,
Uwe

Mnietek1
Mnietek1Author
Inspiring
August 5, 2016

Thx for answers.

I mean graphic frames - not text frames.

Source graphic frame can contains just an image or group of objects.

I'd like to copy whole content of one frame to another.

I thought there is faster method than use of copy() and pasteInto()

___

sorry for my English

Community Expert
August 5, 2016

… I thought there is faster method than use of copy() and pasteInto()

Without adding something, that is not inside the source graphic frame?
Like a group object or a text frame one can anchor something to?
Unfortunately no.


Otherwise you have to sample all possible properties with their respected values of the target object, do a duplicate of the source and apply the stored values to the duplicate. Plus remove the original target.

But that would remove assumed unique properties like the id number of the object from all the id numbers of all objects in the document, would remove "private" data set by insertLabel() and 3rd party plugIns that is hard or impossible to gather…

Regards,
Uwe

Peter Kahrel
Community Expert
Community Expert
August 5, 2016

Assuming that the two frames were named on the Layers panel, you can do this:

from = app.documents[0].textFrames.item('from');

to = app.documents[0].textFrames.item('to');

from.parentStory.duplicate (LocationOptions.AFTER, to.insertionPoints[0]);

Peter

Mnietek1
Mnietek1Author
Inspiring
August 5, 2016

pkahrel napisał(-a):

Assuming that the two frames were named on the Layers panel, you can do this:

  1. from=app.documents[0].textFrames.item('from');
  2. to=app.documents[0].textFrames.item('to');
  3. from.parentStory.duplicate(LocationOptions.AFTER,to.insertionPoints[0]);

Peter

I can't get this to work.

"If you placed a group of images (any group, in fact) in a frame, then that frame is a text frame"

Are you sure? I get error "Object is invalid" when I try to access parentStory property of frame which contains group of objects...

Community Expert
August 6, 2016

I don't think I suggested anywhere that you were dogmatic, Uwe:)

Not sure I follow you on the helper frame. I mean, I can follow the code, but I'm mystified why you use it.

P.


Hi Peter,
just an example.

Without a helper text frame it's hard to impossible to transfer a duplicate of the contents of a source (graphic frame) to the target (also a graphic frame).

What's left, at least as far I can tell, is the method contentPlace() one can try one's luck.

I did some tests with that some years ago. As far as I can remember I was only able to transfer a group of objects, not a single object without grouping it.

Will try that later.

But if you have a better method doing a transfer without using a helper object or doing the boring pasteInto(), I would be interested to hear from it.

Thanks,
Uwe

Community Expert
August 5, 2016

If this is not for InDesign Server, you could use the ExtendScript methods select(), copy(), pasteInto() and move().
Just as you do this in the UI.

What is your version of InDesign?

contentPlace() would be another option, also available for InDesign Server.

InDesign and InDesign Server CS5.5 and above:

If you want to cheat a bit, you could add() a new text frame to the target graphic frame, duplicate() the contents of the source frame, move() the duplicate to the right place above the target and anchor it by insertAnchoredObject() to the added text frame.

What did you try so far with code?

Regards,
Uwe