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

how parametr duplicate(destPage,["0","0"]);?

Community Beginner ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

i dont know parametr duplicate(destPage,["mx","my"]);

how work mx , my ?

when mx = 0 , my=0  text frame place center page.

pleas description mx , my .

TOPICS
Scripting

Views

687

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
Guru ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

According to the documentation this optional parameter -- called by -- is the amount by which to offset the new text frame from the original text frame's position.

Let's illustrate this with example:

I have two pages with a text frame selected on the 1st page.

2018-02-19_14-30-22.png

The following code will duplicate it to the 2nd page shifting it 10 mm to the right and 20 mm downwards:

main();

function main() {

    var doc = app.activeDocument;

    var destPage = doc.pages[1];

    var tf = app.selection[0];

    tf.duplicate(destPage, ["10 mm", "20 mm"]);

}

2018-02-19_14-31-05.png

Negative values will shift it to the left and upwards respectively

tf.duplicate(destPage, ["-10 mm", "-20 mm"]);

2018-02-19_14-29-47.png

You can also use other units, say, inches

tf.duplicate(destPage, ["1 in", "2 in"]);

2018-02-19_14-31-58.png

or the default units set for rulers in preferences. (I personally work in millimeters)

tf.duplicate(destPage, [10, 20]);

Hope it helps.

— Kas

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 Beginner ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

tanks

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 Beginner ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

this have a perablem .

outFrame =sourceFrame.duplicate(destPage,["10 mm","10 mm"]);

the out put is :

this not position  10mm*10mm.

pleas Guide me.

98.JPG

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 Beginner ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

LATEST

this code correct:

sourceFile = File.openDialog ("Show me the source"),

    destPage = app.activeDocument.pages[0],

    sourceDoc = app.open(sourceFile, false),

   sourceFrame = sourceDoc.pages[0].textFrames[0];

outFrame =sourceFrame.duplicate(destPage ,["10 mm","10 mm"]);

  outFrame.move(["13 mm","13 mm"]);

sourceFile = File.openDialog ("Show me the source"),    destPage = app.activeDocument.pages[0],    sourceDoc = app.open(sourceFile, false),   sourceFrame = sourceDoc.pages[0].textFrames[0]; outFrame =sourceFrame.duplicate(destPage ,["10 mm","10 mm"]);
  outFrame.move(["13 mm","13 mm"]);

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