Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I am sure that you have store image link to myCornerLogo.
Try with below code
var myRoundCornerTopRightGroup = myCornerLogo.parent.duplicate ([1, 1]);
Shonky
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
If you send more code of your script then its easy to catch the error.
Shonky
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Pink line is no longer pick, so it's this line that it stops at:
var myRoundCornerTopRightGroup = myCornerLogo.parent.duplicate ([1, 1]);
Thank you.
Copy link to clipboard
Copied
try to replace with this
var myRoundCornerTopRightGroup = myLinkArray[0].duplicate ([1, 1]);
Shonky
Copy link to clipboard
Copied
Got it, thank you very much.
Yulia
Copy link to clipboard
Copied
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
Find more inspiration, events, and resources on the new Adobe Community
Explore Now