Autologin via ssh telnet and execute command

Hi, i need to make a script that make this:
/system ssh address=192.168.1.1 user=guest
password: (i have put the password"
Enter ? for help.
CPE> reboot
CPE> Are you sure? [Y/n] no

Reboot CLI system!! Bye!


Is possibile to automate this process?


Thanks