Packaging Script as Objects

See Also      Tasks

Microsoft® Scripting Components (scriptlets) provide you with an easy way to create powerful, reusable controls. You create scriptlets using a Web scripting language such as Microsoft® Visual Basic® Scripting Edition (VBScript) and ECMAScript (a standard language based on JScript™ 2.0 and JavaScript 1.1). After creating your scriptlet, you can register and use it the way you would any ActiveX™ control.

Scriptlets:

Types of Scriptlets

You can create two types of scriptlets:

DHMTL scriptlets are used as visual controls in an application, and are suitable for display in client applications such as Internet Explorer and Visual Basic. With DHTML scriptlets, you can use the graphical and hypertext capabilities of Web pages as a visually rich interface for an application, such as a calendar control that you can display in a Web page, in Visual Basic or in another COM-based environment.

How DHTML Scriptlets Work

If you are creating a DHTML scriptlet, there are two aspects to your scriptlet. The first is the visual interface. You create this as you would for a Web page using DHTML.

The second aspect is the scriptlet's control interface: the properties, methods, and events that allow you to use the scriptlet as a control. You create these control elements using script that follows certain conventions for how methods and properties are exposed, and how events are trapped and forwarded to the host application.

For example, a DHTML scriptlet might define animation that moves and resizes text on the page. You use DHTML to define the text and set its color, size, and location. You then use scripts to define properties that another application can use to set the speed and direction of the animation text, and methods that allow another application to start, stop, and pause the animation.

Note   To learn more about using Dynamic HTML in your Web pages, you can view the documentation for the Internet Client SDK located at http://www.microsoft.com/msdn/sdk/inetsdk/help/default.htm.

After creating a DHTML scriptlet, you can use it as you would any control. You can add it to toolbars, draw it on a form, or add it to a Web page. In the host application, the DHTML scriptlet is hosted by a scriptlet container object. The container object creates a window for the DHTML scriptlet and provides a way for the host application to specify where the scriptlet displays, at what size, and so on. The scriptlet container object also provides the interface for you to set and get the DHTML scriptlet's properties, call its methods, and respond to its events.