I always found it annoying that when I start Huawei's MobileConnect application, I must first enter the PIN for accessing the SIM card of my USB 3G modem before I can connect to the provider. Luckily, the program is rather verbose with debug output. So it was quite easy to retrieve the essential part for entering the PIN. It simply consists of some good old Hayes AT modem-communication commands.
I wrote a Perl script that fetches the PIN to your SIM card from a Keychain entry. In order to use this script, you have to create a Keychain entry under the account simpin. Here's how:
Principally you can save it now and use it. But you might want to add a bit more convenience. Probably your Huawei 3G modem automagically mounts as a volume in the Finder as mine does, containing the above mentioned MobileConnect application. We can exploit this fact with means of the Do Something When (DSW) System Preferences panel that can execute a program when a drives mounts.
After installing DSW, activate it and enter a new rule (with the modem disk already mounted). Mine is named web'n'walk, so I selected at 'When' web'n'walk Mounts and at 'What' Open YourAutomatorWorkflow/App, with 'After a Delay of' set to 0 seconds works fine for me. Don't forget to start Do Something When.
We can make the whole thing even a bit more convenient. As the mounted drive isn't actually needed, we could eject it:
on run {input, parameters}
tell application "Finder"
activate
eject disk "web'n'walk"
end tell
return input
end run
Change web'n'walk' to the drive name of your 3Gmodem.Mac OS X Hints
http://hints.macworld.com/article.php?story=20080425015358517