Change this line so that it effects ALL open docs in InDESIGN

Hello,

I have this script that deletes all unused colors from the swatches panel in InDesign.


tell application "Adobe InDesign CC 2018"
	tell active document
		delete unused swatches
	end tell
end tell

I am trying to find the line that would address ALL OPEN DOCUMENTS, not just the active one.

Does anyone know if it is possible to have a script talk to all open documents?

thank you!
Babs

Browser: Safari 537.36
Operating System: macOS 10.14

Hi ya

this works fine for ID 2020, not sure about 2018.

 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

Hi Budgie,

It worked perfectly in 2018 after changing to that app.

Thank you so much!

Trying to clean up files and this will help.

Greatly appreciated!

Babs :slight_smile:

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

Replace

tell application "Adobe InDesign 2020"

with

tell application id "com.adobe.InDesign"

Hi Stefan,

Long time!

Thank you for this tip.

Just jumping back into this stuff and that is very helpful. :slight_smile:

Thank you!!
Babs