BcPost.RunVBScript(code)

Description

This function allows you to pass VB scripting code via the Lua engine.  Because our posting engine has always had the VB Scripting for applications engine in it for many years, we implemented this call just in case any existing code would want to be reused. 

IMPORTANT:  The syntax handling for this is important, as it is actually Lua parsing by passing a string and then VB all from our C++ code base, you must be a little stringent on your characters specifically when dealing with quotes and new line characters.  Please review the examples below to understand more!

Parameters

  • code – string containing the VBScript code that should be run

Return

Will return the output of the VBScript code in a string format when using the MILL_SetReturnString() function that exists in our VB scripting language.

Examples


-- This example shows how to format the quote characters as the input to the function is a string itself

-- The message box being displayed is the VB message box

BcPost.RunVBScript("MsgBox(\"Hi from VB Lua\")")


-- This small example shows the need for the \n newline characters and how to return a value

test = BcPost.RunVBScript("a=17 \n b=12 \n c=a+b \n CALL MILL_SetReturnString(c)")

Bcc.ShowMessageBox(test, {Title = "Lua calling VB"})


The result of the above example will show a message box with 29, the value calculated into the variable c