• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Moving embedded graphic to another frame

Participant ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

Hi all,

I am trying to move an embedded graphic from its container to another one. Nor duplicate nor move seems to offer such ability.

Capture d’écran 2016-11-07 à 16.31.30.png

I wish to avoid place command. I was more trying to re-affect the container's graphic instance.

Any idea ?

TIA Loic

TOPICS
Scripting

Views

716

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 07, 2016 Nov 07, 2016

Hi Loic,

yes. 🙂

Select the frame that is holding your portrait image.
Shift click the other graphic frame to add it to the selection and run this snippet:

var graphic = app.selection[0].graphics[0];

var target = app.selection[1];

target.contentPlace([graphic]);

Cheers,
Uwe

Votes

Translate

Translate
Community Expert ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

Hi Loic,

yes. 🙂

Select the frame that is holding your portrait image.
Shift click the other graphic frame to add it to the selection and run this snippet:

var graphic = app.selection[0].graphics[0];

var target = app.selection[1];

target.contentPlace([graphic]);

Cheers,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

Thanks Uwe,

I gave contentPlace a try before I post there and couldn't get it to work. Obviously I was misusing it !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

Hi Loic,

well, sometimes DOM documentation is a bit misleading 😉

Example: You'll find contentPlace() also with [object Group], but I could not find a way yet to contentPlace an object directly as member of a group. An error will be thrown if you try.

Also: If you feed  contentPlace() with more than one object in the array the objects will not be placed inside the target, but directly on the spread of the target. Stacked to and distanced from each other. Where the distance follows a rule that I still have to figure out.

Example where the source is on spread 1 and the target is on spread 2:

1-SourceOnSpread1-TargetOnSpread2-contentPlace.png

Code:

var doc = app.documents[0];

var arrayToPlace = doc.spreads[0].pages[0].allPageItems;

var target = doc.spreads[1].pages[0].pageItems[0];

var result = target.contentPlace(arrayToPlace);

app.select(result);

Result after running the snippet:

2-SourceOnSpread1-TargetOnSpread2-contentPlace-RESULT.png

And in this case no error message is thrown…

Just an example…

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 08, 2016 Nov 08, 2016

Copy link to clipboard

Copied

LATEST

Nice to know

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines