How do I handle HTML forms using applescript?


I’m a newbie to applescript and this forums (this is my first post here!) and i was wondering if anyone could help me out.

I run some beginners web design classes at college and we normally handle forms using cgi scripts on the college server to imitate a web setting. however there is major building work going on at the college and the only people who will have access to the network at all will be support staff for the best part of a year! consequantly all our machines are now standalones. my query is this:

If a student makes a web page containing a form via HTML or dreamweaver can I set things up so that when they hit the SUBMIT button it Posts the data to an applescript in the same folder on their HD which handles the form data and if needed sends the results back? In effect it would be simulating a cgi set up only locally.

does anyone know if this is possible and if so can anyone point me in the direction of a ample script? I’ve never tried applescript before although I have used Hypertalk, Supertalk and lingo.



While it is technically possible to have AppleScript process the network connections (listening to port 80, reading a HTTP request, returning the data, etc.), by far your simplest solution would be to run a web server on each machine and write your script as a normal CGI process.

In this way your script doesn’t get bogged down with the overhead of maintaining the network connection, and you’re much closer to a real-world scenario, making the experience that much more valuable.

There’s several online examples of implementing CGIs in AppleScript, and there are web server packages for most versions of the Mac OS - Apache is built into Mac OS X, and WebStar (plus others) run on earlier Mac OS releases.