• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Remove ALL unused colors from ALL open docs

Enthusiast ,
Dec 04, 2019 Dec 04, 2019

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

TOPICS
How to , Scripting

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 04, 2019 Dec 04, 2019

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

 

Votes

Translate

Translate
Contributor ,
Dec 04, 2019 Dec 04, 2019

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();

        }

    }

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2019 Dec 04, 2019

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 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2019 Dec 04, 2019

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 )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2019 Dec 04, 2019

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 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2020 Mar 04, 2020

Copy link to clipboard

Copied

LATEST

Thank you for this script. It worked well.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2019 Dec 04, 2019

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2019 Dec 04, 2019

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 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines