I'm not really sure, but I think it may be with these lines of code. You may want to try revising the rand paremiters, or deleate the perenthisis around the end of the until loop. I hope this helps in any way.
randnum=Rand($909,$7E7E)
Until (randnum=shortascii) Or (seed=$FFFF)
randnum=Rand($909,$7E7E)
Until (randnum=shortascii) Or (seed=$FFFF)