Look into expect. An expect script will allow you to connect to a box and run whatever commands you need to run, just as if you were typing them.
It'd look something like:
I guess it could depend on whether Your script is interactive, and whether You are picky about screen output, but You can try running Your sequence of commands (from a file, without a shebang) by feeding them to ssh like this,