I read a different approach: Have PuTTY write contents to a log file. Then have AutoHotKey read from a file.
This may provide the relevant info:
Here's another approach:
It involves selecting text, which copies it to the clipboard, and then have AutoHotKey read from the clipboard. (It also saves a copy of the clipboard before clobbering the clipboard, and restores the backed up clipboard data).
shows a simple example of logging in with PuTTY.
I've tested zero of these solutions. So, good luck.
If you have access to the server, you may wish to look into doing stuff on the server side. For instance, you can have an SSH key that only permits the user to run one command (or the start of a command, like "sudo mount" but not "sudo anything-else"); sudo can also provide restrictions on what command is used. OpenSSH can allow a single user to have multiple keys. So, choosing which key you use, on the local/client end, could affect that happens when you connect to the server. Details, which will probably be useful for anyone wishing to explore this route, may be found from: