Opening a bunch of Terminal tabs in Leopard
Every morning I run two shell scripts on my Mac: one that sets up my SSH tunnels, and gives me a shell on another machine; and another that launches Synergy.
Laziness got the better of me today, and I decided to automate it. I wanted to create two tabs in the current Terminal application. Of course, AppleScript is awful, but in this case it's the right solution.
Here's what I came up with. I had to use System Events to create the new window, because Terminal's dictionary doesn't include such niceties as “make a new tab”.
on new_tab(scr)
tell application "Terminal"
activate
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script scr in selected tab of the front window
end tell
end new_tab
my new_tab("tunnel.sh")
my new_tab("synergy.sh")
Posted at 2009-01-21 10:07:00 by Richard Newman • Link to Opening a bunch of…
