14 Replies Latest reply on Feb 13, 2015 7:54 AM by CarlosCanto

    Renaming selection with even or odd increments

    tinydots

      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!