Script to Autofill a Username / Password in Safari?

Hi…I’m sort of new to using AppleScripts. I was wondering if it would be possible to write a script that can handle a web-based authentication (it’s a firewall) every 4 hours.

The initial URL brings up a page where I have to input my username and press submit. (POST Method)
The next URL brings up a page where I then have to input my password and press submit. (POST method again; it’s just one field)

*Is there a way to simply autofill the values and automatically submit the data?

The final page requires me to select a standard sign on (radio button) and press submit one more time.

Another problem that comes up with the first two pages is a warning about the site’s certificate. How can I bypass this?

Any help would be appreciated.

It could be done simply using “curl”. You need only know the “name” of the form elements (just take a look to the html code) and its target. This is a sample, login into Kevin Gogerty’s website at http://digiprint.hldns.com/applescript/aslogin.html:

set referrer to "http://digiprint.hldns.com/applescript/aslogin.html"
set POSTData to "email=whatever@whatever.com&password=password&-DB=asuserlog.fp5&-Lay=main&-Format=asuserwelcome.html&-Error=asuserError.html&-Script=&-new=Submit"
set remoteApp to "http://digiprint.hldns.com/FMPro"
do shell script "cd ~/desktop; curl -e " & referrer & " -d " & quoted form of POSTData & space & remoteApp & " -o result.html"