telnet scripts

I have some old scripts that used to work but don’t with the latest version
of telnet (I’m using V5.0)

they went something like this:
cat telnet.commands > /dev/ptypf
on -t /dev/ttypf telnet -lmyName host.name
cat /dev/ptypf > telnet.log

Basically my script want to telnet into another system execute some
commands, extract the output and quit.

This no longer works. Is there some magic that I can do to make it work?