Moving Items to Layers Based on Color


I’m trying to work out a script that will move items to a specific layer based on color. Most of the items will be text boxes, but I’d like to get everything of a certain color to end up on a specific layer. I started working on a script to deal with text boxes, but Quark throws a “Some data was the wrong type” error. Any ideas?

Here’s the code:

tell application "QuarkXPress"
	tell document 1
		set BoxList to (uniqueID of every text box whose color of word 1 of story 1 is "Red") as list
		repeat with i from 1 to count of text boxes
			set boxName to uniqueID of text box i
			if boxName is in BoxList then move text box i to layer "Red Text"
		end repeat
	end tell
end tell


Sorry for not mentioning I’m using QuarkXPress 6.5.