How to create a simple text color script for Word

Hi, I need a script for school that will type all consonants in black and vowels in red using Office Word. I’m sure there is an easy way to do this but I know little about scripting. Does anyone know a script that will do this. Your help is much appreciated.

Hi,

very slow but simple


property vowels : "aeiou"

tell application "Microsoft Word"
	tell active document
		repeat with i from 1 to count characters
			set char to character i
			if content of char is in vowels then
				tell font object of char to set color to {255, 0, 0}
			else
				tell font object of char to set color to {0, 0, 0}
			end if
		end repeat
	end tell
end tell

Stefan, Many thanks for your quick reply. Your script worked fine. My sincere thanks for your assistance.

M