RunVBScript
- Last UpdatedOct 29, 2026
- 1 minute read
Executes a statement in VBScript language.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
RunVBScript |
Module Activity |
Synchronous |
No |
Supported |
Supported |
Not supported |
Supported |
Not supported |
Syntax
RunVBScript ( strScript, "optTagReturnError" )
strScript
The VBScript statement (string or string tag) to be executed by the function.
optTagReturnError
Name of the string tag that will receive the error (if any) generated by the VBScript statement (such as "Division by zero"). The double-quotes around the string tag name are required.
Returned value
|
0 |
Error |
|
1 |
Success |
Notes
This function will only work on a runtime station that support VBScript.
This function is useful to execute VBScript statements from interfaces that support the built- in language only (such as Scheduler groups). You can also call VBSCript functions created in the Global Procedures.
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 (for example, "Division by zero"). |