First configure a public/private key pair for passwordless ssh-logins. This is what you need before you can write unattended scripts.
Look at these google hits, the process is well-documented: ssh private key setup
Once you have a key - assume that the key for your remote ssh server is "/home/alien/.ssh/myremoteserver" - you use a "here-document" to run the remote commands:
ssh -i "/home/alien/.ssh/myremoteserver" -l alien some.remote.net <<EOT
Using ssh-keys it is also possible to copy files between the two sites unattended (nice for backups):
rsync -va -e "ssh -i /home/alien/.ssh/myremoteserver -l alien" some.remote.net:mydailybackup_20070908.tar.gz .