Script opens two terminal windows I coded this little AppleScript using Automator:

tell application "Terminal"
do script "myscript"
end tell


This perfectly works but has a side effect: when I close the window, there's always the Terminal window to close, so there are two windows, the one that executes the script and the Terminal.

Is there any way to have just one window running?
Try:

tell application "Terminal"
    if not (exists window 1) then reopen
    activate
    do script "echo hi" in window 1
end tell