Use Keychain Scripting to autocomplete certain logins
Nov 30, '05 07:07:00AM
Contributed by: leenoble_uk
My bank thinks it knows better than me, and stops Safari from auto-completing my access details. There are ways around this, such as setting up a proxy to rewrite the bits of HTML and JavaScript on the page which prevent auto complete from working, but I wanted to try a different approach. I've never scripted the Keychain before, and along the way, I found a gotcha for those of you who might have tried before.
There is a bug in Keychain Scripting in Panther which makes it impossible to get any key values from a chain which contains a secure certificate. My bank makes me use one. The solution is to create a new separate keychain for AppleScript to use.
- Open Keychain Access and choose "New Keychain" from the File Menu.
- Give it a name like "ApplescriptKeys" or whatever you like.
- Create a new password item in your new keychain containing your bank login details. Username goes in the account box.
- Adjust the settings of the new keychain to whatever you like -- whether you want it to lock automatically, etc.
Now we're finished with Keychain Access. You now need to open Script Editor and paste this bit of code. Save the script to your ~/Library/Scripts folder as Bank Login.scpt, or whatever you like. Now you just navigate to the login screen at your bank's website, and run the script from the script menu.
Depending on your settings, you may be asked for your new keychain's password. It's up to you whether you always allow access for AppleScript to read this keychain. I just click Allow Once each time. It's still quicker than typing out my banking password. It also allows me to use a completely random password, and not even know what it is because the keychain will remember it for me. The usual security-related disclaimer applies, but seriously, once someone's logged in to your desktop, all bets are off anyway.
[robg adds: This worked quite nicely for me, and I found it easier to implement than the previous hint. It seems the scripting bug (feature) is still present in 10.4, though -- based on my brief testing, it looks like I'll need to create a new Keychain for each site I wish to access in this manner.]
Comments (9)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20051122040350199