With ssh, a lot depends on what you want to do on the other end.
You can do things like:
ssh username@remote.system.address command_or_shell_script arg1 arg2 arg3 ...
and run many things on the remote system.
You could pipe commands into the ssh stdin
(echo command arg1 arg2 arg3 ...
echo script arg1 arg2 arg3 ...
echo another_cmd args...
etc...
) ssh username@remote.system.address
You can use the 'expect' commnd to script input to the remote system where expect and adapt to responses from the other side (see "man expect"; and then do lots of Googling for example)
Now if what you want to do is have ssh send remote screen interactions, such as mouse movements, or changing screen focus, or in anyway interacting with the GUI of the remote system, that is going to be more difficult, as often times the remote ssh session is NOT running in the same environment as the GUI and when you issue system event, apple script, automator actions via an ssh session they often do not have an open channel into the GUI.
So your mileage may vary.