Copy link to clipboard
Copied
Hello,
Is there any way to have InDesign Select ALL unused Colors and Delete them automatically from ALL open documents?
Best,
Babs
You can use either javascript or AppleScript. If you want to compile with Script Editor this Applescript will work:
tell application "Adobe InDesign CC 2018"
repeat with x in every document
tell x
delete unused swatches
end tell
end repeat
end tell
Copy link to clipboard
Copied
Hi,
here is a modified script that is based on a script that I found somewhere in the old forum.
var allDocs = app.documents;
for (var i = 0; i < allDocs.length; i++) {
trashUnusedSwatch (allDocs[i]);
}
function trashUnusedSwatch(myDocument){
var id, sw;
while (myDocument.unusedSwatches[0].name != "") {
id = myDocument.unusedSwatches[0].id;
sw = myDocument.swatches.itemByID(id);
sw.remove();
}
}
Copy link to clipboard
Copied
Hello and thank you!
However, I was not able to compile the code without an error?
I was able to find this script below and I added it to my scripts in InDesign and it works for the current open document, but, trying to figure out how to write it so it does the action to ALL open docs..
tell application "Adobe InDesign CC 2018"
tell active document
delete unused swatches
end tell
end tell
I assume changing "active Document" to something else, might work, but everything I try will not compile.
Any thoughts would be greatly appreciated.
Thank you ,
Babs
Copy link to clipboard
Copied
Hi Babs,
crazyPanda's code is not AppleScript code.
It's for ExtendScript (JavaScript).
How to work with ExtendScript-code:
http://www.indiscripts.com/pages/help#hd0sb2
FWIW: It will remove all unused swatches that are named.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Ewe,
Thank you..I have actually been looking at this page, not sure how I found it, but slowly reading through it, as this is very different than anything I have seen, but it looks like the latest stuff for InDesign...
Have not found anything yet, on any site that helps with this issue, as I cannot move the items from their initial folder, so I can't do a bactch to a folder. Has to be for ALL the open documents... Was hoping that one line could have a simple syntax change to address all the docs? So, I will keep digging for that,
But going to look more at this ExtendScript page... so thank you!
babs
Copy link to clipboard
Copied
Thank you for this script. It worked well.
Copy link to clipboard
Copied
You can use either javascript or AppleScript. If you want to compile with Script Editor this Applescript will work:
tell application "Adobe InDesign CC 2018"
repeat with x in every document
tell x
delete unused swatches
end tell
end repeat
end tell
Copy link to clipboard
Copied
Hi Rob_day,
That worked great.....
I also just got this one here..
tell application "Adobe InDesign CC 2018"
repeat with i in every document
set active document to i
tell front document
set UnusedSwatches to unused swatches
repeat with UnusedSwatch from 1 to count of UnusedSwatches
try
delete UnusedSwatches
end try
end repeat
end tell
end repeat
end tell
Both work well for this...
Thanks everyone!!!!!
Babs