Maybe not all of you know about the possibility of Eval module to evaluate little scripts more complex than a math or string expressions.
Here a little dummy script just to give you an idea.
The script check if a string variable has a "0" inside it. If yes reports it and parse 3rd token.
uses "EVAL"
uses "CONSOLE"
'---Some timing variable
dim t0, t1 as double = timer
'---This string containing the script to be executed
dim MyString as string = "
'---DIM AUTO will automatically dimension new variables when found
dim AUTO
'---No need to DIM the variable if DIM AUTO is in place
'---If variable ends with a $ it is string, otherwise numeric (EXT)
Info_GotIt$ = "" <--- Got it.""
'---Add a "GOT IT" message every time "0" is found inside the main string
IF instr(InternalScriptStringVariable, ""0"") then
InternalScriptStringVariable = InternalScriptStringVariable & Info_GotIt$
InternalScriptStringVariable = InternalScriptStringVariable & "" Number is: "" & parse$(InternalScriptStringVariable, chr$(32), 3)
END IF
"
'---Used to get back results from Eval
dim sResult as string
'---Define a looper and its max
dim Count as long
dim MaxCount as long value 500
for Count = 1 to MaxCount
'---Set InternalScriptStringVariable variable and value
Eval_SetString("InternalScriptStringVariable", "Looper is " & Count)
'---Eval_String will evaluate MyString and will return result
Eval(MyString)
'---Get back the value of the internal variable after script has modified it.
sResult = Eval_GetString("InternalScriptStringVariable")
'---Write some info output
printl format$(Count, "0000") & " - Eval_String returned: " & sResult
next
'---Measure the ending time
t1 = timer
'---Final results
printl "------------------------------------------------------"
printl "Total execution time for " & MaxCount & " loops: " & format$(t1-t0, "#0.00000")
'---Stop execution
waitkey
Bookmarks