2 Replies Latest reply on Jul 23, 2013 8:56 AM by tlumbis

    Deleting unused swatches except for...

    tlumbis

      I have a script that cleans up my document... one of the functions is that it deletes unapplied swatches. This works well for me most of the time but in instances where I'm using a color whose name begins with a "D", I want the script to ignore it.

      In my workflow, "D" represents a digital process and we don't apply a color swatch to digitally printed artwork but a "D" swatch is necessary for our output program to sort the job to the correct printer. The swatch names vary but always begin with a "D" (DBLK, DGLD, DGRN....).

      Thoughts, suggestions?

      Thank you very much for your help.

       

      //delete unused swatches

      var myIndesignDoc = app.activeDocument;

      var myUnusedSwatches = myIndesignDoc.unusedSwatches;

      for (var s = myUnusedSwatches.length-1; s >= 0; s--) {

           var mySwatch = myIndesignDoc.unusedSwatches[s];

           var name = mySwatch.name;

      // alert (name);

        if (name != ""){

      mySwatch.remove();

      }

      }

       

       

      (I found this little script somewhere in these forums - I apologize for not having the credit information available)