the first script: sTT = stringIDToTypeID, dsc = new ActionDescriptor() dsc.putEnumerated(sTT('colors'), sTT('colors'), sTT('shadows')) dsc.putInteger(sTT('shadowsUpperLimit'), 0), dsc.putBoolean(sTT('invert'), false) ref1 = new ActionReference(), ref2 = new ActionReference(), ref1.putClass(sTT('path')) dsc.putReference(sTT('null'), ref1), ref2.putProperty(sTT('selectionClass'), sTT('selection')) dsc.putReference(sTT('from'), ref2), dsc.putUnitDouble(sTT('tolerance'), sTT('pixelsUnit'), .5) executeAction(sTT('colorRange'), dsc), executeAction(sTT('make'), dsc) len = (sPI = (pI0 = (aD = activeDocument).pathItems[0]).subPathItems).length for(arr = [], i = 0; i < len; i++) { for(pts = [], j = 0; j < (pP = sPI.pathPoints).length;) pts.push(pP[j++].anchor); (sel = aD.selection).select(pts), hst = aD.histogram[0] if (!arr.length || hst > arr[0][0]) arr[0] = [hst, pts] pI0.remove(), sel.select(arr[0][1]) returned: ^ it also took a lot of time this script sTT = stringIDToTypeID, dsc = new ActionDescriptor() dsc.putEnumerated(sTT('colors'), sTT('colors'), sTT('shadows')) dsc.putInteger(sTT('shadowsUpperLimit'), 0), dsc.putBoolean(sTT('invert'), false) ref1 = new ActionReference(), ref2 = new ActionReference(), ref1.putClass(sTT('path')) dsc.putReference(sTT('null'), ref1), ref2.putProperty(sTT('selectionClass'), sTT('selection')) dsc.putReference(sTT('from'), ref2), dsc.putUnitDouble(sTT('tolerance'), sTT('pixelsUnit'), 1) executeAction(sTT('colorRange'), dsc), executeAction(sTT('make'), dsc) len = (sPI = (pI0 = (aD = activeDocument).pathItems[0]).subPathItems).length for(arr = [], i = 0; i < len; i++) { for(pts = [], j = 0; j < (pP = sPI.pathPoints).length;) pts.push(pP[j++].anchor); (sel = aD.selection).select(pts), hst = aD.histogram[0] if (!arr.length || hst > arr[0][0]) arr[0] = [hst, pts] pI0.remove(), sel.select(arr[0][1]) returned: this script: sTT = stringIDToTypeID, dsc = new ActionDescriptor() dsc.putEnumerated(c = sTT('colors'), c, sTT('shadows')) executeAction(sTT('colorRange'), dsc) dsc.putInteger(sTT('shadowsUpperLimit'), 0), dsc.putBoolean(sTT('invert'), false) ref1 = new ActionReference(), ref2 = new ActionReference(), ref1.putClass(sTT('path')) dsc.putReference(sTT('null'), ref1), ref2.putProperty(sTT('selectionClass'), sTT('selection')) dsc.putReference(sTT('from'), ref2), dsc.putUnitDouble(sTT('tolerance'), sTT('pixelsUnit'), 1) executeAction(sTT('make'), dsc) returned: so every one of them still haven't selected the main subject
... View more