Table 13.3 lists the only two events that are available with the ScriptControl. The Timeout event occurs after the user chooses End from the dialog box, after the script program has timed out. The Error event occurs whenever an error is encountered in the script program. You should use the Error object, described next, to determine the cause of the error and take the appropriate action.
Table 13.3: ScriptControl Events
Event | Description |
Error | Occurs when the scripting engine encounters an error condition |
Timeout | Occurs in timeout conditions when the user selected End from the dialog box |
WARNING: No runs, no hits, no Error event: If you don’t have an Error event in your application, any errors found by MSScript will trigger a runtime error in your application. Even a little syntax error while trying to add a script to a module can cause your application to end with a runtime error.