Random Delete a selection of


hi,

 

i trying create script specify percentage of selected items want remove.

here have far.

 

i still need work out on alert prompt , if statement, now, have feeling selection.length keep changing each time illustrator delete object, , don't know how make stick.

 

 

var selection = app.activedocument.selection;   //alert prompt dialog percentage of deletion   (var = 0;  < selection.length;  i++) {       if (math.random < 0.5) { //need work out percentage         alert("yes")         selection[i].remove();     } } 

 

thanks help,

when removing items script reverse loop… so…

 

var select = app.activedocument.selection;  var count = select.length;  ( var = count-1;  >= 0;  i-- ) {      if ( math.random < 0.5 ) {            alert("yes");            select[i].remove();      };    }; 

 

that way object indexes won't broken ( out of range ) array reduces…



More discussions in Illustrator Scripting


adobe

Comments

Popular posts from this blog

Adobe Acrobat Pro , Terminal Server Use

Thread: transmission-daemon isn't playing nice: "409: Conflict"

Thread: gpg: Conflicting Commands