Last week, it struck me that I spend a significant amount of time at the beginning of each day bootstrapping my work environment. I usually launch iTerm2 (my favorite Mac OS X Terminal replacement), type several commands, open some TextMate projects, start some Rails servers and on and on. Sounds like a job for automation!
Fortunately, iTerm2 comes with fairly good AppleScript support right out of the box. You can open new terminal windows and tabs, set properties on each and issue commands, among other things. Though it’s not perfect (for instance, you can’t yet easily open split panes), it’s enough to get one started down the road to workday automation nirvana.
Without further ado, here’s my current work environment script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
For more AppleScript + iTerm2 goodness, check out this post by Samantha Halfon.
Also, I was able to find a decent AppleScript key code reference.
Happy automating!
EDIT: Altentee has written a helpful article on this subject with another sample work environment script.