Created
October 1, 2013 20:46
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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