Skip to content

Instantly share code, notes, and snippets.

@rchampourlier
Created May 26, 2012 14:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rchampourlier/2794125 to your computer and use it in GitHub Desktop.
Save rchampourlier/2794125 to your computer and use it in GitHub Desktop.
AppleScript for lazy developer on a Mac: opens multiple terminal tabs, run a set of commands on each tab
-- This script...
-- It assumes when you ssh into the vagrant box you automatically cd into
-- the project's directory (by having a `cd /vagrant` within your
-- `~/.bashrc` for example)
using terms from application "Terminal"
tell application "Terminal"
activate
-- open the terminal's window, set its dimensions
set tab1 to do script
set currentWindow to front window
set position of currentWindow to {1740, 60}
set number of rows of tab1 to 40
set number of columns of tab1 to 190
-- start the vagrant box, wait until it's up to continue
do script "dev-avdice" in tab1
do script "vagrant up" in tab1
repeat
delay 0.5
if busy of tab1 is false then exit repeat
end repeat
-- tab 1: ssh in vagrant
do script "vagrant ssh" in tab1
delay 0.5
-- tab 2: ssh in vagrant and run spork
tell application "System Events" to keystroke "t" using command down & return
set tab2 to tab 2 of currentWindow
do script "dev-avdice" in tab2
do script "vagrant ssh" in tab2
do script "bundle exec spork" in tab2
delay 0.5
-- tab 3: ssh in vagrant and run rails console
tell application "System Events" to keystroke "t" using command down & return
set tab3 to tab 3 of currentWindow
do script "dev-avdice" in tab3
do script "vagrant ssh" in tab3
do script "bundle exec rails console" in tab3
delay 0.5
-- tab 4: ssh in vagrant and run spork
tell application "System Events" to keystroke "t" using command down & return
set tab4 to tab 4 of currentWindow
do script "dev-avdice" in tab4
do script "vagrant ssh" in tab4
do script "bundle exec rails server" in tab4
end tell
end using terms from
@rchampourlier
Copy link
Author

Added missing part to set window's size

@arnogues
Copy link

modify the .profile of the box it's more simple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment