A handy little AppleScript for Bootstrapping development.

Geeky Stuff

So I don’t blog much, and further more I hardly (if ever) blog about anything tech related. For a blog that claims to be about “tech talk” this is unacceptable :P So with that here is my first, and hopefully not my last, tech-ish blog post.

If you are like me, and since you are reading this I am going to assume you are. Then you are a developer (or my friend) and you probably have at least two, if not more, projects on the go.

Personally at this point I have the following things on the go:

  • Lidar Services International - A realtime arial surveying application written in Java. (Tools: eclipse / versions) note: Versions is a great SVN client I use for everything.
  • BeautifulGardenCreator - A Java / Rails tool for Garden Stuffs… (Tools: eclipse / TextMate / versions / terminal : with rails app, console, and scripts running)
  • Matygo - A Rails App for connecting students to tutors (Tools: TextMate / Versions / Terminal : see above)
  • Masters Work - Stay Tuned (Tools: xCode, TextMate : Erlang / Latex / Misc)
  • What ever else I feel like doing with my free time… :)

So needless to say, I am a busy busy boy. What this also means at that on any given day I have to set up a different work context to get some stuff done. This can be as simple as switching the workspace in eclipse, or completely quitting everything opening text mate, launching rails… the list goes on. Wanting to save a few key strokes I figured (at the suggestion of my buddy Paul Lambert ) this was a job for AppleScript.

AppleScript is fairly straight forward, and really, without even understanding much of the particulars of the language, I was able to get the functionality I desired. The most exciting bit of all of this, which isn’t news to probably anyone, is that AppleScript compiles to Apple application bundles. This means that I can launch my development context from my most favourite of favourite app launchers, quicksilver.

So here is an example, a simple script that launches the terminal, opens three tabs (Tab 1: the rails app, Tab 2: the ruby console, Tab 3: the rails directory to run generators and so forth) and runs TextMate on the current directory. This of course requires that you’ve installed the command line mate capability.

Hope someone finds this helpful.

Cheers,

.joe

set directory to “~/Documents/Software/Matygo/matygo.com”set change_directory to “cd ” & directory

on new_terminal_tab()

tell application “System Events” to tell process “Terminal” to keystroke “t” using command down

end new_terminal_tab

– launch terminal stuff

tell application “Terminal”

activate

– launch rails app

do script change_directory in selected tab of the front window

do script “mongrel_rails start” in selected tab of the front window

– launch the console

my new_terminal_tab()

do script change_directory in selected tab of the front window

do script “script/console” in selected tab of the front window

– set another tab with the current directory for

– the purpose of running generator scripts

my new_terminal_tab()

do script change_directory in selected tab of the front window

do script “mate .” in selected tab of the front window

do script “clear” in selected tab of the front window

end tell


Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>