Declare Status , TCL
; Create Tcl Interpreter object
TCL_Create TCL , "C:\Tcl\bin\tcl85.dll" , 1
; Define a new inline Tcl funtion MyReturn2
TCL_AddCode TCL
proc MyReturn2 {arg1} {
if { $arg1 < 100 } {
return "a"
} else {
return "b"
}
}
TCL_EndCode
TCL_Eval Status , TCL , "set a 12" ; Status contains 12 (equivalent to Status=12)
TCL_Eval Status , TCL , "set a 12^Jset b 16" ; Status is 16
TCL_Eval Status , TCL , "set a 12^Jputs $a" ; STatus is 12
; Ccll MyReturn2 with parameter 21, Status will return 12
TCL_Eval Status , TCL , `puts " MyReturn2 of 21 is: [MyReturn2 21]"`
; Ccll MyReturn2 with parameter 221, Status will return 16
TCL_Eval Status , TCL , `puts " MyReturn2 of 221 is: [MyReturn2 221]"`
; Ccll MyReturn2 with parameter 300, Status will return 16
TCL_Eval Status , TCL , `MyReturn2 300`
; Open Windows file explorer to load your Tcl script from a file.
Declare FileName
InputOpenFileName Status , FileName
if Status != 0 Then
; Execute the loaded Tcl script as is.
TCL_EvalFile Status , TCL , FileName
TMMessage GT_InfoID , 'Result = ' $ Status
EndIf
; You must delete the TCL object at the end.
TCL_Delete TCL
; Let _RetStat = 0
; Let _RetVal = 0
End ;@DBG:NEST - 1 - @DBG:IsInJob; Exit Current Test