Apple obviously hates copy and paste. They didn't add it to the iPhone for years, and even when they did add it, they only briefly allowed users to paste into the VPN password field, removing it with one of the first incremental updates to OS 3.0. Luckily there's an app for that – CopyPasteFix, only for jailbroken iPhones.
And then came Snow Leopard, OS X 10.6. They included built-in IPSEC VPN, freeing users from the shackles of the horrible Cisco IPSEC client. But yet again, Apple decided that users don't need to copy and paste text into the password field.
For anyone with a OTP soft token (like a RSA SecurID), this is a pain in the ass. Half the benefits of generating a passcode on the same device that you're using it on, are not having to type it.
Enter AppleScript, everyone's favorite natural language that thinks it's acceptable to use apostrophes when referencing variables. I've never actually written an AppleScript longer than tell application "iTunes" to playpause so this was new ground for me. Joe mentioned he has a similar script for junky non-RSA soft token solution he uses, but he left the country immediately after taunting me with the prospect of getting the code.
If you're doing any moderately serious AppleScript development, I highly recommend Script Debugger from Late Night Software. It was invaluable to seeing what objects and properties were really available, and troubleshooting errors.
What it does
- Prompts for your SecurID PIN (you can save this in the script, I highly recommend you NOT do that)
- Launches the SecurID application (it if it's running it will quit it first), generates a token, stores the token in a variable, and then quits the SecurID application
- Kicks off the VPN connection process, types in the generated passcode when the window is available, and logs in.
If there's any type of a banner with terms to accept, it won't click OK there.
Download the script, view the source code and read more at the project page.






