I was playing around with BetterTouchTool today (which, by the way, is one of the best Mac addons I've ever seen) and decided that I wanted to have a keyboard combination to toggle my Wifi settings. BetterTouchTool gives you the ability to execute a script, however, that causes a Terminal window to open if you write a bash script. This can be disabled through other means, but I found out it's easiest to just write an AppleScript file.
The code below is what I'm using to do this. I've bound this script to a keystroke combination via BetterTouchTool, and it's working perfectly: