Hi all,
Is it possible to find the duplicate pathitem in the document without selecting those pathitems.It is possible to find the duplicate path items by selecting all the objects in the ducument,but i m not getting any clue to find the same without selecting.
If it is possible then please give some suggestion on how to achive this ?
Thanks,
Sanat
i`m not quite sure what you`re asking, but i hope this somehow helps your goal:
//let's create the duplicate first
var b = app.activeDocument.selection[0];
b.name = "##SOURCE##";
b.duplicate();
app.activeDocument.selection[0].name = "##DUPLICATEDSOURCE##";
//let's test if we can find and remove our previously duplicated object
var mydupObj = app.activeDocument.pageItems.getByName("##DUPLICATEDSOURCE##");
mydupObj.remove();
hope it helps;
cheers;
i might've misunderstood your question first time ... probably you`re looking to check if 2 objects are duplicates without creating the duplicate programatically. if so this might give you an inside look. test it by creating a shape, selecting it, copying it and pasting it in place ... you can play with the ignoreProperties string to make the comparison more general:
var doc = app.activeDocument;
var sel = app.activeDocument.selection;
var ignoreProperties = "|name||width||height|";
function AreDuplicates(o1, o2) {
for(prop in sel[0]) {
try {
if(sel[0][prop] != sel[1][prop] && ignoreProperties.indexOf("|" + prop + "|") > -1) return false;
} catch(er) {}
finally { continue; }
}
return true;
}
if(AreDuplicates(sel[0], sel[1])) alert("Wheeee, they are sooooooooo duplicated!");
else alert("Damn and i really hoped that ... never mind!");
hope it helps;
cheers;
Hi sonic,
Thanks for your approach.Without selecting means without using "app.activeDocument.selection".The script will scan all the objects in the current activeDocument without selecting those objects.It will find for any duplicate appearance of the objects and if it is found,alert the message saying duplicate path.
Thanks,
Sanat
North America
Europe, Middle East and Africa
Asia Pacific