what I want to accomplish is something like the one described in this this question. Basically using AppleScript to send commands to the Terminal.app.
However there's this behavior that I don't want: every command sent using do script
directive is echoed to the Terminal. I am currently integrating an AppleScript with Cocoa, and sometimes the software would send sensitive information such as password to the Terminal.
Is there some way to disable this behavior, such as @echo off
directive in DOS batch files?
EDIT
To clarify my question, I will elaborate more. Suppose we have an AppleScript such as this one:
tell application "Terminal"
set currentTab to do script "login"
do script "username" in currentTab
do script "password" in currentTab
end tell
I noticed that if the Terminal application is already running, with or without any terminal window open, the commands in the do script
directive will be echoed before it is fed to the shell. To illustrate the result of the above script in a Terminal:
Last login: Tue 5 Apr hh:mm:ss on ttys001
login <--\
username <----unwanted echoes
password <--/
<machine>:~ <user>$ login
username: username
password: ****
... (interactive Terminal session)
This doesn't happen however, if the Terminal.app is not running at script execution.