How to get sandwiches on the Internet

One of our neighbors wanted to take orders online, so we hooked up their menu to post to sslserver.com, and then made a web page that “displayed” the orders.

The idea involved a Windows scheduled task, running on their personal computer, next to the kitchen, that would poll a web page for orders.

When new ones showed up, it would print them, and so long as the print succeeded, it would mark the orders as printed. The client code looked like this:

On Error Resume Next
 
Set IE = WScript.CreateObject("InternetExplorer.Application")
 
IE.Navigate("http://example.com/orders/")
 
while IE.busy = True: WScript.Sleep 100: wend
If InStr(IE.Document.Body.innerHTML, "<!-- ok -->") &gt; 0 Then
	Err.Clear
	IE.ExecWB 6,2,2,0
	while IE.busy = True: WScript.Sleep 100: wend
	If Err.Number = 0 Then
		IE.Document.Forms(0).Submit
		while IE.busy = True: WScript.Sleep 100: wend
	End If
End If
 
IE.Quit

Meanwhile, the server code was a (longer, and less interesting) perl script which simply formatted the page printably (using <table> tags and everything) and had a form on it with (hidden) checkboxes. The page included an <!– ok –> right at the end to signal completedness.

Leave a Reply