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

Renaming selection with even or odd increments

$
0
0

I currently have an illustrator file that requires me to rename selections of objects. Currently I'm using:

 

var docRef = activeDocument;


with (docRef){
var sel = docRef.selection; 
for (var i=0; i < sel.length; i++)  {     sel[i].name = 'A:' + (i + 1).toString(); 
}
}

 

Like this, the script names every object in my selection in order (ie A:1, A:2, A:3 etc.)

 

I can't seem to figure out incrementing in even or odd numbers; such as A:2, A:4, A:6.

Can anybody help me out? I just can't seem to get it working like I want.

Thanks!


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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