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

Duplicate graphic in InDesign CS5 js

Participant ,
Sep 03, 2010 Sep 03, 2010

I need to duplicate embedded graphic and it's not working:

var myRoundCornerTopRightGroup = myCornerLogo.duplicate ([1, 1]);

What am I missing.

Thank you for your help.

Yulia

TOPICS
Scripting
1.5K
Translate
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
Engaged ,
Sep 03, 2010 Sep 03, 2010

I am sure that you have store image link to myCornerLogo.

Try with below code

var myRoundCornerTopRightGroup = myCornerLogo.parent.duplicate ([1, 1]);

Shonky

Translate
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 ,
Sep 03, 2010 Sep 03, 2010

No, it didn't work for me, and I was trying earlier with the frame of the logo itself and it was giving me error too.

Thank  you for your  help.

Yulia

Translate
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
Engaged ,
Sep 03, 2010 Sep 03, 2010

If you send more code of your script then its easy to catch the error.

Shonky

Translate
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 ,
Sep 03, 2010 Sep 03, 2010

It's the code that used to work in CS4, but now I am trying to go a little bit a different route to make it work in CS5:

var myCornerFrame = myDoc.pages[0].rectangles.add (myDoc.layers.item ("Die"));

myCornerFrame.geometricBounds = ["-.0139 in",  "-.0139 in", "0.4236 in", "0.4236 in"];

myCornerFrame.strokeWeight = 0;

myCornerFrame.fillColor  = "None";

var myDocPath = myDoc.filePath;

var mySplit = myDoc.name.indexOf ("_");

var myFileName = myDoc.name.slice (0,mySplit);

var myFileNameNew = myFileName.slice (0,2);

var myRootPath = myDocPath.parent.fsName;

var myRootPath = myRootPath + "/";

var mySplitPath = myRootPath.indexOf (myFileNameNew);

var myPath = myRootPath.slice (0,mySplitPath);

var myFolderPath = myPath + "/~prepress/colorSettings/";
myCornerLogo = File (myFolderPath + "/topLeftRoundCorner.eps");
try{
if (myCornerLogo.exists){
  myLinkArray = myCornerFrame.place (myCornerLogo);
  myLinkArray[0].itemLink.unlink();
  }
}
catch (e){}

if(myTopRightCheckbox == true){
            myRoundCornerLeftBottomGroup=myCornerLogo;
            var myRoundCornerTopRightGroup = myCornerLogo.parent.duplicate ([1, 1]);
            myRoundCornerTopRightGroup.flipItem(Flip.HORIZONTAL, AnchorPoint.TOP_RIGHT_ANCHOR);
            myRoundCornerTopRightGroup.move ([myPageWidth+.0625-.0486, myPageHeight/2-.0625]);
           
            var myRoundCornerTopRightGroupPage1 = myRoundCornerTopRightGroup.duplicate ();
            myRoundCornerTopRightGroupPage1.move (myDoc.pages[1]);
            myRoundCornerTopRightGroupPage1.flipItem (Flip.HORIZONTAL, AnchorPoint.BOTTOM_LEFT_ANCHOR);
            myRoundCornerTopRightGroupPage1.move (["-0.0139 in", myPageHeight/2-.0625]);
       
        }

It all works to the point of the pink line. I do get my logo placed and embedded.

Thank you so much.

Yulia

Translate
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 ,
Sep 03, 2010 Sep 03, 2010

Pink line is no longer pick, so it's this line that it stops at:

            var myRoundCornerTopRightGroup = myCornerLogo.parent.duplicate ([1, 1]);

Thank you.

Translate
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
Engaged ,
Sep 03, 2010 Sep 03, 2010

try to replace with this

var myRoundCornerTopRightGroup = myLinkArray[0].duplicate ([1, 1]);

Shonky

Translate
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 ,
Sep 04, 2010 Sep 04, 2010
LATEST

Got it, thank you very much.

Yulia

Translate
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
Engaged ,
Sep 03, 2010 Sep 03, 2010
myCornerLogo = File (myFolderPath + "/topLeftRoundCorner.eps");

Above line showing that you have a File in myCornerLogo and your first post you trying to duplicate myCornerLogo. myCornerLogo not a document object. So instead of duplicating myCornerLogo you try to duplicate  myLinkArray[0].

Shonky

Translate
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