Changing the color of characters in InDesign

I’m trying to change the color of every text character in a document that has it’s fill color set to registration.
So far, I"m getting an error message that says Can’t set <> of {“V”, “o”, “r”, “t” “e”, “c”, “.”} to “Black”
So, it appears to be recognizing the characters that are in Registration" color. It just won’t change those characters to black.


on open of droppedfiles
	repeat with afile in droppedfiles
		
		tell application "Adobe InDesign CC 2014"
			tell document 1

				--Changing all registration text to black
				set registrationSwatch to swatch "Registration"
				set registrationCharacters to (every character of every word of every story whose fill color is registrationSwatch)
				tell registrationCharacters
					set fill color to "Black"
				end tell
				
			end tell
		end tell
	end repeat
end open

AppleScript: AppleScript 2.2.1
Browser: Safari 537.78.2
Operating System: Mac OS X (10.7)

Hi. Your registrationCharacters’ line dereferences the object”converting the text into list items that have no color property. You can specify that to be an object reference, but it’s easier to just prevent, by doing the actions on one line.

tell application "Adobe InDesign CS3"'s document 1
	tell (stories's characters whose fill color's name is "Registration") to if not it is {} then set fill color to "Black"
end tell

Thanks! That worked great. It’s part of a larger code that does a bunch of pre-press stuff to an InDesign file before I drop it on the other script that creates a pdf. I’ll post once the whole code is done. Maybe someone else will find it useful.

--Changing all registration text to black
					set registrationSwatch to swatch "Registration"
					tell (stories's characters whose fill color's name is "Registration") to if not it is {} then set fill color to "Black"