iTerm initialisation script

Here’s an Apple Script that allows to automate iTerm sessions.
tell application "iTerm"
activate
set W to (create window with default profile)
if W = missing value then set W to create window with default profile
tell W's current session
    split vertically with default profile
    split vertically with default profile
end tell
set T to W's current tab
write T's session 1 text "cd ~/Desktop"
write T's session 2 text "cd ~/Downloads"
write T's session 3 text "cd ~/Documents"
end tell
When you hit the “play” button you should get the following output:
If you want your panes to be initialised in active window, you may replace the following script line
set W to (create window with default profile)

by 

set W to current window
Cheers 0/

Leave a Reply

Close Menu