On 2007-01-11, at 19:40, Matthew Lambie wrote:
I've found that 'do script scpt in window 1' works whether or not Terminal is already running.
That's kinda what I'm chasing, but I want to open multiple tabs and run multiple applications, which I can't seem to work out.
I can't honestly help you much with the tabs aspect because I never use them. I also don't script Terminal much because plain vanilla 'do shell script' serves my needs quite well (except for session-like things).
I thought the title would be the text that's displayed on the tab, which is at the moment the name of the process. The window title is "user@machine: /path - app" -- could I use that as a reference to the window that I'm wanting to target perhaps?
You should be able to use that to target a window. Also check the standard dictionary for the 'window' element and it's properties. I'm writing from 10.4.10 at the moment and can't tell you exactly but it looks like you might also be able to get the window title(s) with:
set targwin to "user@machine: /path - app"
tell application "Terminal"
activate
set wnames to (name of every window)
if (wnames contains targwin) then
do script "cd;ls" in window targwin
else
do script "cd;ls" in front window
repeat
set wname to name of front window
if (wname is not "Terminal") then exit repeat
end repeat
wname
end if
end tell