Windows Script Components (WSC)

Windows Script Components (WSC)

Windows Script Components (WSC), formerly known as Scriplets, is a technology for developing powerful COM components in an easy fashion. WSC's can be authored in any scripting language that has implemented the ActiveX Scripting Interfaces, which means that units of PerlScript code can be encapsulated as Windows Script Components.

Be warned, reader, a lengthy introduction to the Component Object Model (COM) stretches until the topic of Windows Script Components. Please move directly to the topic of Windows Script Components if you feel that you understand the COM; the COM is essential to WSC, thus it is necessary to cover the fundamentals of the COM.

The Component Object Model

The Component Object Model (COM) is a language-independent and object-oriented programming model. It is not, however, a programming language, and it does not demand that a new style of programming be learned. It is a binary standard that enables software to be implemented as units called components. The component can be authored in any programming language or scripting language provided that the language supports the standard defined by the COM. After the binary unit has been built, it can communicate with other units that were produced in any other language, on the same machine or on remote machines provided that the units were written as COM components.

As many see it, the Component Object Model is elegant and powerful. The basic yet ingenious programming model provides the foundation for application-development. The power resides in that everything built on the same foundation can communicate with each other without any restrictions such as programming languages or platforms. When developing an application devoted to COM, components should encapsulate every functionality that the application requires. A task performed by the application would be executed by a component, and these components would be reused in other and future applications. For example, a Perl component can contain the process of sending an email or performing a series of regular expressions on text. The component can then be used to provide functionality for an Active Server Pages application or a Windows desktop application.

In summary, although the language in which a component is generated may vary from component to component, a binary standard overcomes the limitation of programming in different languages. It does not care about anything else but the binary form of the machine code that the once source code was turned into and the fact that is implemented into COM. In this sense, the component is not a regular script or executable, but a black box that performs one task and returns the projected result. Multiple languages can be used for one application because COM provides a binary standard. A binary standard also results in platform-independence provided that multiple platforms support COM. Units of code that are used in COM are known as components, and on Windows a component is normally file with the extension .dll; however, there are offshoots such as Windows Script Components, which have the extension .wsc. The purpose of the component is to perform the one task that it has been programmed for, and through COM, it can communicate with other components, languages, and platforms.

A Standard And An Implementation

COM is both a specification and an implementation. And being both a specification and an implementation, the COM defines a standard for how the components are created and how they communicate - namely as objects. As a result, the specification solves the implementation issues of the following key issues:

Although the parts above are involved in the specification of how to implement components, the programmer normally does not have to worry much about them. A software development tool that holds high class will create a skeleton for a component, and leave it up to the programmer only to plug in the code in the right places. Thanks to this, the code itself can be developed, debugged, and experimented with as usual. And then when the code is finished, it is placed in the skeleton, the right buttons are clicked, and the component pops out.

The Parts of A Component

When wondering what makes up a component, recall that COM is an object-oriented programming model that requires every component to be implemented as an object, so from this we know that we will be talking about classes, methods, properties, and such entities that belong in an object-oriented programming model. However, let