I recently upgraded from an old "fried egg" style Optus Wireless Modem to one of the new "stick" models. The old modem never officially supported MacOSX computers, so getting it going was a bit of a hassle, involving downloading a bunch of drivers from other carriers and fiddling with the settings to get it going. Given the fact that Optus used to be an all-Apple shop, their Mac support up until recently for their internet products was pretty rugged.
The new one however, is an entirely different proposition.
It masquerades as a storage device, mounting on the desktop with a real MacOSX installer, so that's good. The first time you want to use it. After that, it's a bit of a pain, because it that means that you get the warning about not correctly ejecting the device if you just pull it out. You have to remember to eject it, although it doesn't seem to matter if you do this before or after you get the internet connection up and running. The device has an application on it that you can use to open an internet connection, check your SIM card for SMS messages, check your usage and so on. All very nice, and utterly superfluous.
DSW to the rescue. Do Something When is a nice bit of kit that can run a script or other program when a particular device is mounted.
I've set DSW up to execute the following:
- 30 seconds after Optus Wireless Broadband mounts, execute ConnectHUAWEI.scpt (an AppleScript, see below)
- 5 minutes after Optus Wireless Broadband mounts, unmount it.
So now I can plug the stick in, and it automatically connects to the internet without needing to go through the dial-up process manually. The 5 minute delay before unmounting gives me sufficient time to run the usage check program if I want to. And when it's pack-up time, I can disconnect and unplug the device cleanly.
Here's the AppleScript:
tell application "System Events"
tell network preferences
tell current location
set aPPPoEService to a reference to (first service whose name contains "HUAWEI Mobile")
if exists aPPPoEService then