As described on page 89 in the actual documentation, I tried to return a value using the Basic syntax, but it does not work for me.
I am using the newest version of TMS Scripter components in Delphi 2007.
Using the Pascal syntax as described works fine for me, but in the Basic syntax (as described in documentation on page 89), it does not:
MAIN = (10+6)/4
results in: "Syntax error. Source position: 1,6
Issue in documentation (?):
(*) In Basic syntax, to return a function value you must use "FunctionName =
Value" syntax. You can also return values in basic without declaring a function. In this case, use the reserved word "MAIN" : "MAIN = (10+6)/4".
My code is ("aStrList" contains the code to execute):
var
vResult : Variant;
begin
if( bVBScript )
then atScripter.DefaultLanguage := slBasic
else atScripter.DefaultLanguage := slPascal;
try
atScripter.SourceCode := aStrList;
atScripter.Compile;
if( atScripter.Compiled )
then vResult := atScripter.Execute;
...
except
on E:Exception do
begin
if( bShowMessages )
then ICCMod_MainForm.ErrorMessage( E.Message );
end; // of E:
end; // of except
end;
Changing the DefaultLanguage will affect the new scripts you create. It won't change language of existing scripts. You have to create a new script to benefit from it: