Using "Send Partial" with WebSTAR 4 and Applescript CGIs

If you want to send responses from your Applescript CGIs in pieces (eg. if you are doing some time consuming processing and want to let the client know that the script has not stalled), here is an example script. Click, copy, and paste into your favorite script editor. As with all Applescript CGIs, save as an applet and check [Keep Open] and [Never Show Startup Screen].


The meat of the script is as follows:
on DoSendData(connectionID, moreToSend, theData)
	tell application "WebSTAR 4.3"
		send partial theData connection connectionID more moreToSend
	end tell
end DoSendData

You must, as always, return a full http response header. There appears to be no need for a return command.

You will need to use your browser's [Back] button to return here.

My thanks to Wayne Walrath, and the WebSTAR-DEV list, for helping me finally figure this out.