ID JS CS2 - CS3: copy items inline/anchored in a new layer...

Hello:

I was wondering if someone has a script to copy an object inline/embedded and place a copy of it in the same position on a new layer without him being anchored to what anyone on the new layer? I don't want to remove the embedded/inline object from the first layer. I want to just copy the size and position on a new layer.

I would be very grateful for your help.

Thank you!

Theresa

Hey!

Try this: (this has been tested in CS5 and CS4, but it should work in CS3 as well)

var myDoc = app.activeDocument;

// use to process entire document
var myItems = myDoc.allPageItems;

// use to process just current page
// var myItems = app.activeWindow.activePage.allPageItems;

var foundObjects = Array();

for(var i = 0; i < myItems.length; i++){
  if(myItems[i].parent instanceof Character){foundObjects.push(myItems[i]);}
}

if(foundObjects.length > 0){
  var myDestLayer = myDoc.layers.add({name:"Anchor/Inline Duplicates"});
  for(var i = 0; i < foundObjects.length; i++){
    var newDuplicate = foundObjects[i].duplicate(myDestLayer);
    newDuplicate.geometricBounds = foundObjects[i].geometricBounds;
    try{newDuplicate.graphics[0].geometricBounds = foundObjects[i].graphics[0].geometricBounds;}catch(_){}
  }
}

I hope that helps!

--

tomaxxi

http://indisnip.WordPress.com/

Tags: InDesign

Similar Questions

Maybe you are looking for