パスの選択ポイントの反転

イラストレーターに選択範囲の反転というコマンドは用意されている。
だが、残念なことにパスポイントを選択しているに、
パスポイントの選択の反転をしてくれない。
だから作ってみた。
スクリプトからパスポイントの選択のオンオフの挙動が把握しにくくて、
ちょっと困った。

ダウンロード

//2009-09-10 あるようでなかったので作ってみた
#target 'illustrator';
#include 'c.js';
(function(){
    c.selection().pathItems().each(function(){
        var PL = this.pathPoints.length;
        var P_RL = [];
        var PS = c(this.selectedPathPoints).each(function(){
        			if(this.selected == PathPointSelection.ANCHORPOINT)return this;
        			P_RL.push(this);
        	});
            this.selected = false;
            this.selected = true;
 
            c(PS).each(function(){
            		this.selected = PathPointSelection.NOSELECTION;
            });
            c(P_RL).each(function(){
                    this.selected = PathPointSelection.ANCHORPOINT;
            });
    });
})();