illustrator crashes when running a script to loop through paths
Hello,
Does anyone know why my illustrator is crashing when I run this script? When I take out the loop for the pathItems, it does what I want. It selects the group named "5". Now I need to select all the paths with a specfic name like "50", but illustrator keep crashing.
var doc = app.activeDocument;
var activeLayer = doc.activeLayer;
var getLayer = doc.layers.getByName("clouds");
for (var i = 0; i < doc.layers.length; i++) {
layer = doc.layers[i];
if (layer.name === "clouds") {
//doc.activeLayer = doc.layers.getByName("clouds");
for (var ii = 0; ii < doc.groupItems.length; ii++) {
group = doc.groupItems[ii];
if (group.name === "5") {
//group.selected = true;
for (var p = 0; p< doc.pathItems.length; p++) {
path = doc.pathItems[p];
if (path.name === "50") {
path.selected = true;
alert("path loop success");
} // end path if statement
} // end path loop
} // end group if statement
} // end group loop
} // end layer if statement
} // end layer loop
