Copy link to clipboard
Copied
Hi Everyone ,
Im trying to remove the unwanted swatches in my document. But it would not work. Could anyone help me to remove the unwanted swatches in the active document
Hi Raghav,
There is no direct API to delete the unused swatches. This possible via action only. There is another way of doing this but in the end it also using actions. Try following code
function unusedSwatch(){
actionString = [
'/version 3',
'/name [ 8',
'756e757365647377',
']',
'/isOpen 1',
'/actionCount 1',
'/action-1 {',
'/name [ 8',
'737774636864656c',
']',
'/keyIndex 0',
'/colorIndex 0'
...
Copy link to clipboard
Copied
Hi,
You can record the action and execute the action using script. I have recorded the action, you can download the action file from. below link and make sure to keep this file on your desktop. Following is the script to execute the action file
var actionFile = File(Folder.desktop + "/Delete Unused Swatches.aia");
app.loadAction(actionFile);
app.doScript('Delete Unused Swatches', 'Set 1');
app.unloadAction('Set 1', '');
Let us know if this works for you.
Copy link to clipboard
Copied
Hi Charu,
Thanks for your update. Is there any possible way for delete the unwanted swatches without making actions file?
Copy link to clipboard
Copied
Hi Raghav,
There is no direct API to delete the unused swatches. This possible via action only. There is another way of doing this but in the end it also using actions. Try following code
function unusedSwatch(){
actionString = [
'/version 3',
'/name [ 8',
'756e757365647377',
']',
'/isOpen 1',
'/actionCount 1',
'/action-1 {',
'/name [ 8',
'737774636864656c',
']',
'/keyIndex 0',
'/colorIndex 0',
'/isOpen 0',
'/eventCount 2',
'/event-1 {',
'/useRulersIn1stQuadrant 0',
'/internalName (ai_plugin_swatches)',
'/localizedName [ 8',
'5377617463686573',
']',
'/isOpen 0',
'/isOn 1',
'/hasDialog 0',
'/parameterCount 1',
'/parameter-1 {',
'/key 1835363957',
'/showInPalette 4294967295',
'/type (enumerated)',
'/name [ 17',
' 53656c65637420416c6c20556e75736564',
']',
'/value 11',
'}',
'}',
'/event-2 {',
'/useRulersIn1stQuadrant 0',
'/internalName (ai_plugin_swatches)',
'/localizedName [ 8',
'5377617463686573',
']',
'/isOpen 0',
'/isOn 1',
'/hasDialog 1',
'/showDialog 0',
'/parameterCount 1',
'/parameter-1 {',
'/key 1835363957',
'/showInPalette 4294967295',
'/type (enumerated)',
'/name [ 13',
' 44656c65746520537761746368',
']',
'/value 3',
'}',
'}',
'}'
].join('\n')
$.writeln('hit')
var f = new File(Folder.desktop + "/unusedsw.aia");
f.open('w')
f.write(actionString)
f.close()
app.loadAction(f)
app.doScript('swtchdel','unusedsw')
app.unloadAction('unusedsw', '');
f.remove();
}
unusedSwatch();
The difference here is action string is in the code instead of separate file. It also creating a file in the background but also removing it. For me it is almost same solution just a different way of doing that.
Copy link to clipboard
Copied
Salut!
Activer le menu de la palette...
et choisir "SƩlectionner les nuances non utilisƩes
Puis faire glisser la sƩlection dans la corbeille.
de elleere
Copy link to clipboard
Copied
Please upload code unable to downlaod action file.
Copy link to clipboard
Copied
you can record your own Action to try first script, or use the second script Charu posted, that one does not require the action to be present.