0 Replies Latest reply on May 20, 2008 12:45 PM by (AdamN)

    [VBScript] Delete unused swatches NOT gradient swatches

      Hi everyone,

      Heres the problem. When this executes, it properly deletes all unused swatches BUT it also deletes ALL gradient swatches regardless of whether or not they're used. I've fixed this by restricting the script to delete swatches that don't contain the string "gradient", but this doesnt solve the problem entirely because now it doesnt dump unused gradient swatches.

      Set myInDesign = CreateObject("InDesign.Application.CS2")
      Set currentDoc = myInDesign.ActiveDocument

      myUnusedSwatches = currentdoc.UnusedSwatches.Count
      For myLoop = 1 To myUnusedSwatches
      on Error Resume Next
      if instr(lcase(currentdoc.unusedswatches.item(1).name), "gradient")=0 then
      Set myUnusedSwatches = currentdoc.UnusedSwatches.Item(1)
      myUnusedSwatches.Delete
      end if
      Next

      Any thoughts?

      Adam