Copy link to clipboard
Copied
Hi,
I need to remove the unused swatches in a document. Dont no how to get the swatch name applied in a document with the color value. Anyone knows pls let me know.
Regards,
Sudha K
Copy link to clipboard
Copied
go to the swatches palette and in the fly out menu, click on the "Select All Unused" menu item, then click on the trash can icon.
Copy link to clipboard
Copied
Hi,
I need to remove unused swatches using script. Dont know to find that the document(pageitems in a document) contains the color from swatch group. how to find and remove unused swatches from the swatch palette. If anyone knows let me know.
Thanks,
Sudha K
Copy link to clipboard
Copied
function deleteUnusedSwatches (doc) { var items = doc.pageItems, len = items.length, sw = doc.swatches, slen = sw.length, arr = [], str = null, i = 0, j; for (; i < len; i ++){ doc.selection = [items]; arr.push(sw.getSelected()[0]); } str = arr.toString(); for (j = slen - 1; j > 1; j --){ RegExp(sw
.name).test(str) || sw .remove(); } } deleteUnusedSwatches(app.activeDocument);
It seems this will do the job.
Edit:
Sorry, this will not work as expected.
And I recall there is already one writed by John Wundes which also remove all unused symbols and etc.