Hi Tim,
31:32: syntax error: Expected “then”, etc. but found unknown token. (-2741)
that seems to point at the "not equal to" sign as being saved incorrectly when you save the command. If you change that to
"is not equal to"
(ie, replace the ≠ symbol with this text) in both places it occurs I imagine the command will get happier. It's probably conversion to a different encoding (UTF-8?) on saving that's stuffing up the script. Doubtless someone knows a better workaround than this (my Applescript days are long gone), but in the meantime this might get you started.
Cheers, Paul