EvaluateString Method
Applies To
BasicTcl Object, AdvancedTcl Object
Prototype
EvaluateString(Interpreter As Long, CommandString As String, CommandOutput As String, ErrorLine As Long) As Long
Input
The "Interpreter" parameter, which must be a valid interpreter pointer. The "CommandString" parameter, which contains the commands to evaluate.
Output
The "CommandOutput" parameter, which receives the result of the evaluation. The "ErrorLine" may be modified to contain the line number of an evaluation error, if any. Initially, the "CommandOutput" parameter must be NULL (vbNullString).
Returns
The result of the evaluation, which will be one of the following:
TCL_OK
TCL_ERROR
TCL_RETURN
TCL_BREAK
TCL_CONTINUE
COM Results
S_OK: Success.
E_INVALIDARG: Either a NULL pointer was passed or the "Interpreter" parameter is invalid.
E_FAIL: The Tcl interpreter returned an unknown result.
Side Effects
One or more custom commands may be called by the interpreter. This method should be called with great care from inside custom commands, otherwise unwanted recursion may occur.
Description
This method is a wrapper around the Tcl_Eval function. The result of the evaluation is placed into the "CommandOutput" parameter. If an evaluation error occurs, the line number of the error is placed into the "ErrorLine" parameter.
Notes
None.
Example
Private Sub Command1_Click()
    Dim poTcl As TclBridge.BasicTcl
    Dim plInterpreter As Long
    Dim psOutput As String

    Set poTcl = New TclBridge.BasicTcl

    Call poTcl.CreateInterpreter(plInterpreter)

    ' psOutput will equal the current clock value in seconds
    ' since the "start of time"

    psOutput = vbNullString
    plResult = poTcl.EvaluateString(plInterpreter, "set x [clock seconds]", psOutput, 0&)

    Call poTcl.DeleteInterpreter(plInterpreter)

    Set poTcl = Nothing
End Sub