Hi,
Im trying to write a script that removes all pageItems that has a specific Swatch as fillColor.
I almost succeed, the only problem is that the for-loop breaks after half of the items on the page is removed.
I really do not understand what Im doing wrong. Does anybody have any explanation?
Best regards
Anders
var doc = app.activeDocument;
var all = doc.pageItems;
var colorName = "myColor"; //Name of the swatch
color = doc.swatches.getByName ( colorName );
color = color.color ;
for (i = 0; i < all.length; i++)
{
if (
eachPath.fillColor.cyan == color.cyan
&& eachPath.fillColor.magenta == color.magenta
&& eachPath.fillColor.yellow == color.yellow
&& eachPath.fillColor.black == color.black )
{
all.remove();
}
}