Evenly Select Anchor Points
Hi,
I would like to select every n(th) anchor points of select path(s).

I found a script tried to modify it I am able to remove every 2nd anchor point but what I really want is to select them. (And surely there is a better way to do this.)
main();
function main(){
if(documents.length < 1) return;
var s = activeDocument.selection;
if(!(s instanceof Array) || s.length < 1) return;
var paths = [];
extractPaths(s, 0, paths);
var p, j;
for(var i = paths.length - 1; i >= 0; i--){
p = paths.pathPoints;
totalpoint = p.length;
//alert (totalpoint);
for(j = totalpoint - 1; j >= 0; j--){
if ( j && (j % 2 === 0)) {
p
.remove(); //p
.PathPointSelection.ANCHORPOINT.isSelected = true ; }
}
if(p.length < 2 && isSelected(p[0])) paths.remove();
}
redraw();
}
// ----------------------------------------------
function isSelected(p){ // PathPoint
return p.selected == PathPointSelection.ANCHORPOINT;
}
// --------------------------------------
function extractPaths(s, pp_length_limit, paths){
for(var i = 0; i < s.length; i++){
if(s.typename == "PathItem"){
if(pp_length_limit > 0
&& s.pathPoints.length <= pp_length_limit) continue;
paths.push( s );
} else if(s.typename == "GroupItem"){
extractPaths( s.pageItems, pp_length_limit, paths);
} else if(s.typename == "CompoundPathItem"){
extractPaths( s.pathItems, pp_length_limit, paths);
}
}
}
Thank you for your help.
