The steps involved in automation can be included in a single script or be the actions of several controls in a window. If you want the user to participate in the automation, you might:
Declare an OLE object as an instance variable of a window
Instantiate the variable and connect to the server in the window’s Open event
Send commands to the server in response to the user’s choices and specifications in lists or edit boxes
Disconnect and destroy the object in the window’s Close event
If the automation does not involve the user, all the work can be done in a single script.