Skip to main content
Inspiring
August 4, 2009
Question

delete unused gradients and patterns

  • August 4, 2009
  • 1 reply
  • 1251 views

I posted this in the regular Illustrator forum, but am wondering if there might be a script to do this. I want to keep all of the used gradient and pattern swatches, but select and delete any unused gradient and pattern swatches. The Select All Unused command in Swatches, selects all unused solid colors, as well as USED gradients and patterns.

This topic has been closed for replies.

1 reply

August 7, 2009

I think the only way to do this is to loop through your swatches and paths and test for matches. A lot of effort compared with "Select All Unused Swatches".

pathItems.fillColor.pattern == yourPatternSwatch;

pathItems.fillColor.gradient == yourGradientSwatch;

The only way I know of to test CMYK or RGB path item colours against swatches is to compare actual colour values.

pathItems.fillColor.cyan == yourSwatch.cyan &&

pathItems.fillColor.magenta == yourSwatch.magenta &&
pathItems.fillColor.yellow == yourSwatch.yellow &&
pathItems.fillColor.black == yourSwatch.black

Inspiring
August 7, 2009

Grisslyburr,

Thanks for your comments. Should the scripts that you prvided work as they are or do they need additional code? I tried the first one and got an error message that pathitems is undefined.

August 7, 2009

Hi Jay,

No, they are not scripts. They are the conditions that need to be tested in a script (javascript). There is more code required if you want to script this.

Are you attempting to batch process a large group of files? I think recording an illustrator action would be the best solution for what you are trying to achieve. If you're not batch processing files, why not using the UI rather than a script?

Cheers,

Bay