Export (0) Print
Expand All
0 out of 4 rated this helpful - Rate this topic

Handling Events

Microsoft® Windows® 2000 Scripting Guide

Windows is an event-based operating system. Events generated within Windows are often the result of a user action such as the click of an OK button or the movement of a mouse. Typically, most of the actions performed by a Windows program are the result of handling these user-generated events. For example, when you start an application such as Microsoft Word, the application loads and then waits for you to do something (for example, type something on the keyboard or select something with the mouse). Word will wait indefinitely until you trigger an event that it can respond to.

The event mechanism also enables software components to communicate with one another. When an occurrence takes place in one component (firing component), another component (handling component) is notified of the occurrence. The handling component can respond by performing some action.

Event handling mechanism used by WSH is not commonly employed in system administration scripts. Scripts tend to be procedure-driven; that is, after they have been set in motion, they run on their own, neither looking for nor responding to outside events.

Note

  • The ability to monitor resources and respond to changes in these resources is extremely important. However, this type of event handling is best done using WMI.

Event handling can be important in scripts that automate Windows GUI applications, and such scripts are sometimes useful to system administrators. For example, WSH scripts can use Microsoft Internet Explorer to provide a GUI interface for users. Simple examples of this can be found in the chapter "Creating Enterprise Scripts" in this book.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.