Skip to content

Instantly share code, notes, and snippets.

@kennethdavidbuck
Created October 1, 2013 20:46
Show Gist options
  • Save kennethdavidbuck/6784835 to your computer and use it in GitHub Desktop.
Save kennethdavidbuck/6784835 to your computer and use it in GitHub Desktop.
Example applescript to run a sequence of commands in new Terminal tabs. In this case, running grunt js on paths relative to the applescript.
tell application "Finder"
activate
set this_folder to (the target of the front window) as alias
set dev_root to POSIX path of this_folder
set directories to {"directory1", "directory2", "directory3"}
tell application "Terminal"
activate
repeat with directory in directories
tell application "System Events"
tell process "Terminal"
keystroke "t" using command down
end tell
end tell
delay 1
tell application "Terminal"
do script "cd " & dev_root & "/" & directory & "; grunt" in the last tab of window 1
end tell
activate application "Terminal"
end repeat
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment