Skip to content

Instantly share code, notes, and snippets.

@geeksunny
Created August 11, 2012 08:00
Show Gist options
  • Save geeksunny/3322352 to your computer and use it in GitHub Desktop.
Save geeksunny/3322352 to your computer and use it in GitHub Desktop.
An AppleScript file to open a new tab in Terminal.app and immediately execute a given command.
on run argv
if (count argv) is not equal to 0 then
tell application "Terminal"
activate
tell application "System Events" to tell process "Terminal.app" to keystroke "t" using command down
do script item 1 of argv in front window
end tell
#else
# display alert "Oops!" message "You didn't pass any parameters to this script!" as critical
end if
end run
@geeksunny
Copy link
Author

The 'display alert' line will only work if the script is compiled into a .app

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