Your scripting project may optionally include scripts that handle XMLSpy events such as opening, closing, or saving a document, starting or closing XMLSpy, adding an element to a diagram, and others. These events are provided by the XMLSpy COM API, and you can find them in the "Events" folder of your scripting project. Note that these events are XMLSpy-specific, as opposed to form events. Events are organized into folders as follows:
To create an event handler script, right-click an event, and select Open from the context menu (or double-click the event). The event handler script is displayed in the main window, where you can start editing it. For example, the event handler illustrated below displays an alert each time XMLSpy starts:
Note the following:
•The alert command is applicable to JScript. The VBScript equivalent is MsgBox. See also alert.
•The name of the event handler function must not be changed; otherwise, the event handler script will not be called.
•In order for events to be processed, the Process Events check box must be selected when you enable the scripting project in XMLSpy. For more information, see Enabling Scripts and Macros.
You can optionally define local variables and helper functions within event handler scripts, for example: