Grace, you apppear to be using an applescript to control the browser's refresh function? Is that to renew the controller or to update the camera image? If you explain why this is part of the picture, I think we might 'get it' better.
If the camera is delivering a streamed video, I'd suggest using a frameset, placing the camera view in one frame and the robot controller in another. Think of the controller as providing one command at a time. Each time the user clicks a command or hits submit in the controller frame, the browser, as has outlined, sends that info to the server, which passes it to the acgi, which does the thing and returns a new form (or a redirect to a form) to the browser, which updates the display in the controller frame.