script random colours on letters
Hey, I would like to select a text frame and use a script so that each letter gets randomly coloured with one of the swatches out of my panel.
Does a script like this exist?
Thanks for any tips
Hey, I would like to select a text frame and use a script so that each letter gets randomly coloured with one of the swatches out of my panel.
Does a script like this exist?
Thanks for any tips
here you go:
(function(){
var tf=app.activeDocument.selection[0];
var chars=tf.characters.everyItem().getElements();
var col=app.activeDocument.swatches.length-1;
for (var i=0; i<chars.length; i++){
var rand=Math.floor((Math.random() * col) + 1);
chars.fillColor=app.activeDocument.swatches[rand];
}
}());
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.