How to use AppleScript to launch three scripts, each in new Terminal tab? I'm trying to launch 3 tabs and run a script in each with AppleScript. So far I haven't been able to get this done.  Currently I have:

tell application "Terminal"
    activate
    do script "ping google.com"
    tell application "System Events"
        keystroke "t" using {command down}
        do script "ping yahoo.com"
    end tell
    tell application "System Events"
        keystroke "t" using {command down}
        do script "ping msn.com"
    end tell
end tell


This will launch three tabs but the pings don't execute in the last two tabs.

I'm probably missing something basic here.
&quot;System Events&quot; doesn't understand what you want to do with do script, use the do script command outside of the tell application &quot;System Events&quot; block.

You must specify a window or tab when using the do script command, otherwise a new window will open.



tell application &quot;Terminal&quot;
    activate
    do script &quot;ping google.com&quot; in front window
    my makeTab()
    do script &quot;ping yahoo.com&quot; in front window
    my makeTab()
    do script &quot;ping msn.com&quot; in front window
end tell

on makeTab()
    tell application &quot;System Events&quot; to keystroke &quot;t&quot; using {command down}
    delay 0.2
end makeTab