unused Swatches InDesign issues

OK while it is no problem for me to delete the unusued swatches from a document, I have had some issues manipulating the results. I can return a string of the swatches that is accurate but not seperated with the following:


tell application "Adobe InDesign CS2"
	get name of unused swatches in active document
	set BadSwatch to result
	return BadSwatch as string
end tell

which returns

“C=0 M=0 Y=100 K=0C=100 M=90 Y=10 K=0C=75 M=5 Y=100 K=0OtherREdRedbLueRGB”

I can also use the following to return a count of swatches which should be (6) but it is coming back as (17)


tell application "Adobe InDesign CS2"
	get unused swatches in active document
	set BadSwatch to count of result
end tell

returns

17

using this modification I find the problem. Applescript is finding 11 additional empty swatches, and while I do get comma separated results I have information that is not apparent in the file and unneccesary and detrimental to my results and needs. Any ideas?


tell application "Adobe InDesign CS2"
	get name of unused swatches in active document
	set BadSwatch to result
end tell

which returns

{“C=0 M=0 Y=100 K=0”, “C=100 M=90 Y=10 K=0”, “C=75 M=5 Y=100 K=0”, “OtherREd”, “Red”, “bLueRGB”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”}

Without having the document that you are using to refer to I can’t be sure what is going on. Just a guess but there may be unnamed gradient swatches in the document. You could always put in a conditional statement to check the name and if it is not “” then delete the swatch so that you don’t error out. You also might tell the document to delete every swatch whose name is “” to clear those out. I don’t have InDesign here to check these out but hopefully this will help.

Thanks for the suggestion. I am still working it out. Turns out the “”= false in applescript so there has to be another reference.