Using Applescript for Web Applications

In addition to T.J.'s recommendation, you might want to look at: commandLine.acgi