Writing an e-Mail app in applescript
Unless you're dying to program this yourself, you should probably check out Webmailer. It does pretty much exactly what you're looking for — a handler for mailto links and other system email actions that will redirect them to Gmail, or whatever else you want (it can work with scripts or any URL you want to give it). It's no longer maintained, but I believe it works with Mountain Lion, and it's not the sort of thing that's likely to break anytime soon.