Lessons by Jon
Saving as CGI
I only know how to do this from within the Script Editor application. The
steps will probably differ inside other script editing applications. The
general thing to remember is that the script must be saved as a run-only
application with the splash screen turned off and set to stay open. If the
splash screen comes open it will interfere with AppleEvent processing. If
the application doesn't stay open, it will likely quit before the AppleEvent
is received. This is because there is a slight delay between when MacHTTP
launches the application and when the AppleEvent is sent to the application.
Since most of your CGI applications don't have significant processing outside
of the AppleEvent-handling loop, the application will quit almost immediately.
These are the steps to follow to save an AppleScript script as a CGI
- Click on the "Check Syntax" button so that references to applications
are resolved and any errors are tracked down.
- Select "Save" from the "File" menu if any changes have been made.
- Select "Save as run-only..." from the "File" menu. This will create
an application which cannot be edited, so be sure to keep the source
- Select a name for the application that ends in ".cgi". This is necessary
so MacHTTP will know to treat it as a CGI application. Select the
folder you want to save the application in.
- Click on "Save" to save the application.
Earlier I talked about the difference between synchronous and asynchronous
handling of CGI applications. If you want to use asynchronous handling, then
you should change step (4) so that the filename ends in ".acgi". All of the
scripts I have provided (excepting Script1.txt) can be used as either ".cgi"
or ".acgi" applications by merely changing the filename. This is not true
of all CGI applications, so beware.
Last Edited: November 25, 1994