RunVBScript

Executes a statement in VBScript language.

Function Group Execution Windows Embedded Thin Client Mobile Access
RunVBScript Module Activity Synchronous Supported Supported Supported Not supported

Syntax

  RunVBScript ( strScript, "optTagReturnError" )  
strScript
Script statement that must be executed by the function.
optTagReturnError
Name of the tag that will receive the error (if any) generated by the statement (e.g., “Division by zero”). The tag name must be configured between double-quotes and it must be a String tag.

Returned value

0 Error
1 Success

Examples

Tag Name Expression
TagResult RunVBScript(“MsgBox(Time)”) // Executes the MsgBox function from VBScript and displays the current time.
  RunVBScript(TagStatement) // Executes the statement configured in the value of the string tag TagStatement.
  RunVBScript(“$TagC=$TagA/$TagB”, “TagError”) // Writes in TagC the result of TagA divided by TagB. The error generated by the operation (if any) is written to the string tag TagError (e.g., “Division by zero”).
Tip: This function is useful to execute VBScript statements from interfaces that support the built-in language only (e.g., Scheduler groups). You can also call VBSCript functions created in the Global Procedures.
Note: The runtime station must support the VBScript statements configured in this function in order to execute them.

RunVBScript