Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Random Delete a selection of

$
0
0

Hi,

 

I am trying to create a script to specify a percentage of the selected items you want to remove.

Here is what I have so far.

 

I still need to work out on the alert prompt and the if statement, but for now, I have the feeling that the selection.length keep changing each time Illustrator delete an object, and I don't know how to make it stick.

 

 

var selection = app.activeDocument.selection;


//alert prompt dialog for a percentage of deletion


for (var i = 0;  i < selection.length;  i++) {    if (Math.random < 0.5) { //need to work out the percentage        alert("yes")        selection[i].remove();    }
}

 

Thanks for the help,


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>