U bevindt zich hier:

ActiveXperts.com > ActiveXperts Scripting Toolkit

ActiveXperts Scripting Toolkit

quicklinks


Product Overview

ActiveXperts Scripting Toolkit enables Software Developers to run VBScript program or a command-line tool without invoking the Windows Scripting Host or console window. With ActiveXperts Scripting Toolkit, VBScript programs and command-line tools can be invoked from any application or script.

Usually, you call VBScript programs by invoking the 'Windows Script Host' (either WSCRIPT.EXE or CSCRIPT.EXE). The ActiveXperts Scripting Toolkit directly communicates with the VBScript Engine of the operating system. Some of the benefits of using ActiveXperts Scripting Toolkit instead of using the Windows Scripting Host:

Some benefits of using ActiveXperts Scripting Toolkit instead of the Windows Scripting Host:

  • Function results can be used directly in any application
  • Standard Output and Standard Error are stored in variables, without the need to redirect
  • Call functions directly instead of writing 'stub' code
  • Pass function parameters dynamically - pass the function parameters 'on the fly', directly from your own application or script
  • Set a timeout to prevent functions from not returning, for instanceas a result of an endless loop
  • Intercept program errors that would normally crash the Windows Scripting Host
  • Customize your error messages
  • Support for Windows Services and Web Applications - call a VBScript function directly from a Windows Service or a Web Application

Some benefits of using ActiveXperts Scripting Toolkit instead of executing a command-line tools from a console window:

  • Standard Output and Standard Error are stored in variables, without the need to redirect
  • Set a timeout to prevent a command-line tool from not returning, for instance as a result of an endless loop
  • Support for Windows Services and Web Applications - call a command-line tool directly from a Windows Service or a Web Application

ActiveXperts Scripting Toolkit can be distributed easily to any Windows computer. Once you have purchased the license, you copy the AxScript.dll (or AxScriptx64.dll) to the workstations or servers and register the DLL on those machines.

The ActiveXperts Scripting Toolkit component can be used by any of these development/scripting languages:

  • Microsoft Visual Studio .NET: Visual Basic .NET, Visual C# .NET, ASP .NET
  • Microsoft Visual Studio: Visual Basic 5.x or higher, Visual C++ 5.x or higher
  • Borland Delphi 7.x or higher, Borland C++ Builder 6.x or higher
  • ASP 2.x, HTML, Javascript
  • PHP
  • VBScript
  • Any other development platform that supports ActiveX/COM components

System Requirements

ActiveXperts Scripting Toolkit is available as a 32-bit component and as a 64-bit component (both part of the product):

  • AxScript.dll - 32-bit component;
  • AxScriptx64.dll - 64-bit component.

ActiveXperts Scripting Toolkit runs on the following Operating Systems:

  • Windows 2008 (32 and 64 bit);
  • Windows 2003 (32 and 64 bit);
  • Windows 2000 Server and Professional (32 bit only);
  • Windows 7 (32 and 64 bit);
  • Windows Vista (32 and 64 bit);
  • Windows XP (32 and 64 bit).

Code Snippets and Sample Applications

The following code snippets (VBScript) illustrate how to use the Scripting object.

Visual C# .NET sample showing how to run a VBScript program

using System;
using AxScript;

namespace Example1
{
class Class1
{
  [STAThread]
  static void Main(string[] args)
  {
    XScripting  objScripting = new XScripting ();                             ' Create instance
    XCompletion objCompl;

    objScripting.ScriptFile   = "C:\My Scripts\Script.vbs";                   ' Set VBScrilt file 
    objScripting.Function     = "GetDirectorySize";                           ' Set function
    objScripting.Parameter1   = "\"C:\Windows\"";                             ' Set 1st parameter

    objCompl = objScripting.Run();                                            ' Run the script

    Console.WriteLine( "CompletionCode : {0}",objCompl.CompletionCode );      ' Result 
    Console.WriteLine( "CompletionDescr.:{0}",objCompl.CompletionDescription );' Result (string)
  
    if ( objCompl.CompletionCode == 0 )
    {
      Console.WriteLine( "FuncRetNumber:{0}", objCompl.FunctionReturnNumber); ' Return value
      Console.WriteLine( "FuncRetString:{0}", objCompl.FunctionReturnString );' Return value
      Console.WriteLine( "FuncRetInfo:  {0}", objCompl.FunctionReturnInfo );  ' Return value
    }
    else
    {
      Console.WriteLine( "ComplErrorSrc:    {0}", objCompl.CompletionErrorSource );
      Console.WriteLine( "ComplErrorDescr:  {0}", objCompl.CompletionErrorDescription ); 
      Console.WriteLine( "ComplErrorLine:   {0}", objCompl.CompletionErrorLine );  
      Console.WriteLine( "ComplErrorChar:   {0}", objCompl.CompletionErrorChar ); 
      Console.WriteLine( "ComplErrorCode:   {0}", objCompl.CompletionErrorCode ); 
    }
  }  
}
}
VBScript sample showing how to run a VBScript program

Set objScripting = CreateObject( "ActiveXperts.Scripting" )        ' Create instance>

objScripting.ScriptFile = "C:\My Scripts\Script.vbs"               ' Set VBScrilt file>     
objScripting.Function = "GetDateAndTime"                           ' Set function> 
Set objCompl = objScripting.Run                                    ' Run the script>

WScript.Echo "CompletionCode  : " & objCompl.CompletionCode        ' Result (numeric)>
WScript.Echo "CompletionDescr.: " & objCompl.CompletionDescription ' Result (friendly string)

If( objCompl.CompletionCode = 0 ) Then
 WScript.Echo "FunctionReturnNumber  : " & objCompl.FunctionReturnNumber  ' Return value (Number)
 WScript.Echo "FunctionReturnString  : " & objCompl.FunctionReturnString  ' Return value (String)
 WScript.Echo "FunctionReturnInfo    : " & objCompl.FunctionReturnInfo    ' Return value (Variant)
Else
 WScript.Echo "ComplErrorSource : " & objCompl.CompletionErrorSource ' Shows where error occured
 WScript.Echo "ComplErrorDescription : " & objCompl.CompletionErrorDescription ' Error description
 WScript.Echo "ComplErrorLine   : " & objCompl.CompletionErrorLine   ' Line 
 WScript.Echo "ComplErrorChar   : " & objCompl.CompletionErrorChar   ' Character position
 WScript.Echo "ComplErrorCode   : " & objCompl.CompletionErrorCode   ' MS error code
End If
Click here for more samples.

More information

To read more about ActiveXperts Scripting Toolkit, use one of the following links: