tell application "Adobe InDesign 2020"
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
Offtopic but instead of referring to the application names of the Adobe CC Suite which change frequently I recommend to use the bundle identifiers which donβt change