AppleScript set focus on terminal window
activate application "Terminal"
tell application "Terminal"
   set position of front window to {1, 1}
   set size of front window to {1, 1}
end tell
tell application "System Events" to keystroke "your message here\rexit\r"


Additionally you can get help from
AppleScript get active Application

to put focus back on original application