The preceding
sections provide many examples of using the IOM interfaces in a full
Visual Basic environment (or in a VBA environment like Microsoft Word
and Excel).
You can also use the
IOM interfaces from a VBScript environment. VBScript is a commonly
used scripting language that is available in Active Server Pages (ASP),
Dynamic HTML (DHTML), Microsoft Outlook 97 and later, and Windows
Scripting Host.
Scripto is an ActiveX
DLL that has been developed by SAS in order to provide workarounds
for the following common VBScript limitations:
-
Method calls in VBScript are limited
to a single return value of type Variant.
-
Arrays can contain Variants only.
-
There is no support for reading
or writing binary files.
Note: Scripto is provided with
SAS Integration Technologies so that developers who choose to use
VBScript can effectively use the SAS automation interfaces. However,
Scripto is not specific to SAS and can be used with other automation
interfaces.
The performance of VBScript
is often slower than a Visual Basic application for several reasons.
First, VBScript provides only late binding. It uses IDispatch instead
of v-table calls. Also, VBScript is interpreted, not compiled. In
addition, the way that VBScript invokes methods (InvokeMethod) causes
additional overhead because all parameters must be copied twice to
get them in the proper format.
The slower performance
of VBScript is especially evident in the case of safe arrays in which
SAS expects to contain the actual type of element in the array (such
as string or an enumeration value). VBScript expects it to contain
only VARIANTS, which in turn contain the appropriate type of element.
InvokeMethod takes care of this conversion. However, it produces an
additional copy of the array.
Scripto does not address
these performance issues. We recommend that if performance is an issue,
consider something other than a scripting language for your implementation.
We also recommend that you only use Scripto when calling methods whose
signatures require it.
Two components are implemented
by the Scripto DLL: Scripto and StreamHelper.