2 Replies Latest reply on Sep 17, 2014 1:32 PM by Larry G. Schneider

    Remove swatches not working

    jfizz

      I am using Javascript to script Illustrator. I have a simple for loop which goes over each swatch in the document and removes it... or so I thought. For some reason, only around half of the swatches are actually removed. No error is thrown so I have no idea why it is not working.

       

      Code:

        for(var i = 0; i < activeDocument.swatches.length; i++) {

          activeDocument.swatches[i].remove();

        }

       

      Also note that this works for a few swatches but when you add any significant amount (I have 16), it only removes about half of them.