0

I am trying to get InDesign to list all the colours in a document without listing the default

"None", "Paper", "Black", "Registration"

This is what I have but AS keeps listing "None", "Paper", "Black", "Registration" in the output.

tell application "Adobe InDesign CC 2014"
activate
delete unused swatches of document 1
set notusedSwatches to {"None", "Paper", "Black", "Registration"}
set upDatedList to get (name of swatches of document 1 whose name is not in notusedSwatches)
end tell
MonkeyCMonkeyDo
  • 73
  • 2
  • 11

4 Answers4

0

sadly this does not work ...

interesting though is that you can specify a single name like this

set upDatedList to get (name of swatches of document 1 whose name is not "black"

that will exclude black.

so you will have to loop through them like this

set usedSwatches to {}
tell application "Adobe InDesign CC"
    --activate
    delete unused swatches of document 1
    set notusedSwatches to {"none", "paper", "black", "registration"}
    set theSwatches to name of swatches of document 1
    repeat with aSwatch in the theSwatches
        if aSwatch is not in notusedSwatches then copy aSwatch to end of usedSwatches
    end repeat
    return usedSwatches
end tell

or whenever you have swatch name your doing something with check to make sure its not in the "notusedswatch" list

mcgrailm
  • 17,469
  • 22
  • 83
  • 129
0

converted the not used to a string and it works

set notusedSwatches to {"None", "Paper", "Black", "Registration"} as string
MonkeyCMonkeyDo
  • 73
  • 2
  • 11
0

I have a list-filtering sub-routine I use for this. It takes two lists. The original, and a list of items to filter out from the original.

set allSwatches to {"Red", "White", "None", "Paper", "Black", "Registration", "Green", "Orange"}
set notusedSwatches to {"None", "Paper", "Black", "Registration"}
set filteredSwatches to filterList(allSwatches, notusedSwatches)


on filterList(theList, badItems)
    set goodList to {}
    repeat with i from 1 to (count theList)
        set currItem to item i of theList
        if currItem is not in badItems then
            set end of goodList to currItem
        end if
    end repeat
    return goodList
end filterList
Darrick Herwehe
  • 3,553
  • 1
  • 21
  • 30
-1

Take a look at this link

To check for and remove unwanted color swatches in your file: click the upper right corner of the Swatches palette, and choose Select All Unused, then click the trash can to delete. If you have swatches left that you do not want in your file, some element within your document is using that color. Click on that swatch and try to delete it as well. If you have no embedded or linked files in your document that brought in that swatch, you will be prompted to change the color (which is being used somewhere in your document) to one of the remaining colors in your palette and problem solved! If the swatch is not able to be trashed, it has arrived in your palette from a “placed” item. You will have to go into that linked logo, artwork or photo in it’s native application to redefine the color to the one you need in your job. Once relinked, that swatch will be freed up to be deleted from your palette.

Gexos
  • 3
  • 1
  • Hmm, I apology, it was pretty late when I saw OP's question, all though I'm almost sure that before the OP edited his question, the meaning was how to delete swatches. – Gexos Aug 05 '14 at 13:49
  • All I did in the edit was add Apple Script to the title – MonkeyCMonkeyDo Aug 05 '14 at 23:22