no need to push the items into an array, loop thru all pageItems and test for their typename property
if "PathItem" you know what to do already
if "TextFrame" use fillColor property of the textRange Object
var idoc = app.activeDocument; var sel = idoc.selection; // use the last swatch to color the selected text frame sel.textRange.fillColor = idoc.swatches[idoc.swatches.length-1].color;
if "GroupItem", loop thru its pageItems collection
if "CompoundPathItem" loop thru its pathItems collection
Thanks for the reply. I have a specific layer "REF" that I need to convert all entities on sub layers, groups, compound paths, etc. without selecting them from AI.
Is there a way to loop through the different collections and recurse to get the sublayers?
Layer structures like:
Thanks for your help.