user967722
user967722

Reputation: 1229

Set Terminal tab name w/ AppleScript

I have the following script, which opens Terminal, connects to a remote host and launches a script there:

tell application "Terminal"
    activate
    do script "ssh me@myserver" 
    delay 10
    do script "sh ./startserver" in front window    
end tell

How can I set the name for this Terminal tab?

Upvotes: 2

Views: 3874

Answers (2)

steel
steel

Reputation: 12520

tell app "Terminal" to set custom title of tab 1 of front window to "my tab name"

Upvotes: 4

aqua
aqua

Reputation: 3375

tell application "Terminal"
    activate
    do script "ssh me@myserver" 
    delay 10
    do script "sh ./startserver" in front window 
    set input to "\"\\033]0;<your title here>\\007\""
    do script "echo -n -e " & input   
end tell

Replace <your title here> with whatever text you wish your title to be.

Upvotes: 2

Related Questions