Using the Scriptor Component

The Scriptor component makes it possible to insert code modules into your pipeline. These modules are written using Microsoft Visual Basic Scripting Edition (VBScript). From within a Scriptor component, you can access the OrderForm object, access pipeline context information, create other objects, and even run other pipelines. In addition, because the Scriptor component supports configuration parameters, the Scriptor component provides perhaps the easiest way to write custom components for the Order Processing pipeline (OPP).

When you add a Scriptor component to your pipeline, you configure the component by using the Component Properties dialog box. For more information about using the Component Properties dialog box, see Configuring a Scriptor Component.

Scriptor Methods

To display the property pages for a Scriptor component in the Pipeline Editor, select Internal, and then click the Edit button. The Scriptor component displays an edit window that contains the three routines that the Scriptor component can process.

JScript Sample

Ee825788.note(en-US,CS.20).gifNote

  • When using JScript, "mscsexecute" must be in ALL lower case.
// The following entry points are available (shown in JScript format):
function mscsexecute(config, orderform, context, flags)
{
   return (1);
}
end function

sub mscsopen(config)
{
}
end sub

sub mscsclose()
{
}
end sub

VBScript Sample

''The following entry points are available (shown in VBScript format):

function MSCSExecute(config, orderform, context, flags)

    MSCSExecute = 1

end function

sub MSCSOpen(config)

end sub

sub MSCSClose()

end sub

These routines are called entry points for the Scriptor component, and you can think of them as you would think of the event handlers for a Visual Basic object or Microsoft ActiveX control. You fill in the body of these routines with your own task-specific scripting code, and when the Order Processing pipeline (OPP) runs the Scriptor component, it runs the code that you write.

The script that you write for your MSCSOpen subroutine is run immediately after the Scriptor component is created. The MSCSExit subroutine is run after the Scriptor component is destroyed. The MSCSExecute function is called after the MSCSOpen subroutine, but before the MSCSExit subroutine.

Of the three exports that make up a default Scriptor component, only the MSCSExecute function is required. The parameters that the Scriptor component passes to this function include the following:

  • config. The configuration Dictionary for the script, which contains the information in the following table.
    Name Value
    User-defined configuration parameters Parameter value. For example, if you type tax=1 in the Config box on the property page for the Scriptor component, the tax name/value pair appears in the Configuration dictionary.
    script_type Identifies whether the script is internal or external. If it is internal, script_type contains the value INTERNAL; otherwise, it contains the value EXTERNAL.
    script_text Contains the entire script for the component.
    script_name Contains the fully qualified path to the file that contains the script to run. If the script_type is INTERNAL, this name/value pair does not contain a value.
    engine_prog_id Identifies the scripting engine used to interpret the script. Possible values are VBScript and JScript.
  • orderform. The OrderForm object that you pass to the Execute method of the pipeline object.
  • context. The Context dictionary that you pass to the Execute method of the pipeline object.
  • flags. The flags that you pass to the Execute method of the pipeline object.

Copyright © 2005 Microsoft Corporation.
All rights reserved.