VB-Script Support

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > VB-Script >

VB-Script Support

VBS. - VB-Script Start

Previous Top Next


MiniRobotLanguage (MRL)

 

VBS. Command

Visual Basic Script Start

 

 

Intention

 

This command is used to start a block with VB-Script. It is always used paired with VBE.

 

The statements between a VBS. and a VBE. are ignored by the SPR-Preprocessor.

They are also ignored by the "Pretty-Printer" in the Editor.

 

VBS. and VBE. enable you, to include a VB-Script or Java-Script Code inline into the SPR-Script. You can use it to check for System-Objects (See Sample 2 below), or you can use it to call WMI-Functions.

 

You can also transfer Variable-Content into VB-Script-Variables (see example 1 below). And use them in your VB-Script.

 

And with VBE. you can get a single result value from the VB-Script back into your SPR-Script (see example 2 below).

 

 

 

Syntax

 

VBS.P1|P2[|P3...|Px]

...

VBE.P1

 

 

Parameter Explanation for VBS

 

P1 - (in) - VB or JS - this way you can choose between VB-Script

    and JScript.

 

P2 - (in) - Name of the first function to start, without

    (). The function must have one single parameter which is

    an ARRAY of Variant.

 

P3-Px - (in) - these are the Parameters to transfer into the

    VB-Script. They will be transfered into the VARIANT-ARRAY.

    You can use up to 20 Parameters.

 

P4 - Value*

 

P5 - (out) Variable for Success-flag 1/0.*

 

 

Parameter Explanation for VBE

 

P1 - (out)  - will be set to the result of the VB-Script Function called before.

 

 

 

 

 

Example

 

'**********************************************

' VBS./VBE. - Sample

' You will get two Messageboxes.

' One from inside VB-Script, one from MR.

'**********************************************

DBP.This is a MiniRobots-Script.

' Now starts the VB-Script-Part.

' IMPORTANT:

' The MSGBOX from VB is not TopMost and may be

' hidden behind the EDITOR!

' Keep Editor on the Right side,

' and Keep center of the screen free.

VBS.VB|Multiply|123|124

 Function Multiply(vPrms)

 Dim result

 result = vPrms(0) * vPrms(1)

 msgbox vPrms(0) * vPrms(1),,"from Inside VB-Script"

 Multiply = result

 End Function

VBE.$$RET

MBX.Result: $$RET

END.

 

 

'**********************************************

' VBS./VBE. - Sample 2

' Test if CDO is available

'**********************************************

DBP.Hallo

VBS.VB|Multiply|123|124

 Function Multiply(vPrms)

 Dim c

 Dim msg

 On Error Resume Next

 set c = CreateObject("MAPI.Session")

 If Err <> 0 then

 msg = "CDO ist auf diesem System nicht installiert."

 else

 msg = "CDO-Version " & c.Version & " steht zur Verfügung."

 end if

 msgbox msg

 Multiply = msg

 End Function

VBE.$$RET

MBX.Result: $$RET|from SPR

END.

 

 

 

Remarks

 

The VBS.-/JS.-Scripts will not be written to the harddisk prior to execution. Therefore they are permanently crypted together

with the SPR-Script using the '#CRY:-Option.

 

 

Limitations:

 

It is possible to start the VB-Scripts from inside PRR./PRE.

There are no Limitations about Multithreading here.

 

 

 

See also:

 

    VBE. - VB-Script End