Code: Select all
SYS "LoadLibrary", "EVAL.DLL" TO EVDLL%
SYS "GetProcAddress", EVDLL%, "ExeBasic" TO ExeBasic%
SYS "GetProcAddress", EVDLL%, "GetValue" TO GetValue%
SYS ExeBasic%, "TestNUM1#=1200.25",0,1 TO result%
SYS ExeBasic%, "TestNUM2#=1401.18",0,1 TO result%
SYS ExeBasic%, "TOTAL#=TestNUM1#+TestNUM2#",0,1 TO result%
SYS ExeBasic%, "MSGBOX TOTAL#",0,1 TO resultado
SYS GetValue%, "TOTAL#",0,1 TO resultado_total
PRINT resultado_total
SYS "FreeLibrary", EVDLL%
Code: Select all
'Sample with LBB from a text file
'using EVAL.DLL and execute code from a text file
'
OPEN "CODE.TXT" FOR BINARY AS #BUFFER
code$=Input$(#BUFFER,3267)
CLOSE #1
notice code$
open "EVAL.DLL" for dll as #bufx
calldll #bufx,"ExeBasic", code$ as ptr, 0 as long,1 as long,result as long
'also you can get the value a variable
calldll #bufx,"GetValue", "VAR4#" as ptr, 0 as long,1 as long,result2 as Double
notice str$(result2)
'Or get the value of a string variable
variablex$="VARTEXT$"
text$=space$(255)+chr$(0)
calldll #bufx,"GetTextValue", variablex$ as ptr,text$ as ptr,result as long
notice "Result of VARTEXT$="+text$
CLOSE #bufx
Code: Select all
'Sample for Liberty Basic
'using EVAL.DLL and execute code from variables
'
'you can use this DLL passing code delimited with CHR$(13)+CHR$(10)
CRLF$ =chr$(13) +chr$(10)
sourcecode$="A#=100.42"+CRLF$+_
"B#=20.13"+CRLF$+_
"C#=A#+B#"+CRLF$+_
"MSGBOX C#,0,"+chr$(34)+"Result of EVAL"+chr$(34)+CRLF$+ _
"text$="+CHR$(34)+"My Name Is Israel"+chr$(34)+chr$(0)
sourcecode$=trim$(left$(sourcecode$,32767))
open "EVAL.DLL" for dll as #bufx
calldll #bufx,"ExeBasic", sourcecode$ as ptr, 0 as long,1 as long,result as long
calldll #bufx,"SetTextValue", "R$" as ptr,"This is a test" as ptr,1 as long,result as long
importe=1500.16
calldll #bufx,"SetValue", "R#" as ptr,1500.17 as double,1 as long,result as long
variablex$="text$"
resultado$=space$(255)+chr$(0)
calldll #bufx,"GetTextValue", variablex$ as ptr,resultado$ as ptr,result as long
print "text$="+trim$(left$(resultado$,255))
variable$="A#"
calldll #bufx,"GetValue", variable$ as ptr,valorA as double
print "A#=";valorA
variable$="B#"
calldll #bufx,"GetValue", variable$ as ptr,valorB as double
print "B#=";valorB
variable$="C#"
calldll #bufx,"GetValue",variable$ as ptr,valorC as double
print "C#=";valorC
result=valorC * 10
print "C#*10=";result
variablex$="R$"
resultado$=space$(255)+chr$(0)
calldll #bufx,"GetTextValue", variablex$ as ptr,resultado$ as ptr,result as long
print "Result of R$="+trim$(left$(resultado$,255))
variable$="R#"
calldll #bufx,"GetValue",variable$ as ptr,valorR as double
print valorR
calldll #bufx,"ExeBasic", "TestNUM1#=1200.25" as ptr, 0 as long,1 as long,result as long
calldll #bufx,"ExeBasic", "TestNUM2#=1401.18" as ptr, 0 as long,1 as long,result as long
calldll #bufx,"ExeBasic", "Total#=TestNum1#+testnum2#" as ptr, 0 as long,1 as long,result as long
calldll #bufx,"ExeBasic", "left4$=left$(text$,4)" as ptr, 0 as long,1 as long,result as long
calldll #bufx,"ExeBasic", "right4$=right$(text$,4)" as ptr, 0 as long,1 as long,result as long
calldll #bufx,"ExeBasic", "PARSE2$=PARSE$(text$,"+" Is "+",2)" as ptr, 0 as long,1 as long,result as long
variablex$="LEFT4$"
resultado$=space$(255)+chr$(0)
calldll #bufx,"GetTextValue", variablex$ as ptr,resultado$ as ptr,result as long
print "left4$="+trim$(left$(resultado$,255))
variablex$="RIGHT4$"
resultado$=space$(255)+chr$(0)
calldll #bufx,"GetTextValue", variablex$ as ptr,resultado$ as ptr,result as long
print "RIGHT4$="+trim$(left$(resultado$,255))
variablex$="PARSE2$"
resultado$=space$(255)+chr$(0)
calldll #bufx,"GetTextValue", variablex$ as ptr,resultado$ as ptr,result as long
print "PARSE2$="+trim$(left$(resultado$,255))
variable$="TOTAL#"
calldll #bufx,"GetValue", variable$ as ptr,Total as double
print "Total=";Total
EVAL is my tool for execute script or solve expression using variables. Variables only accept string or numbers. For string variables use the $ identifier, for numeric variables use the # identifier.
This tool have the next mainly functions for execute script:
ExeBasic()
SetValue()
SetTextValue()
GetValue()
GetTextValue()
SetMaxVariables()
SetMaxLines()
ExeBasic()
Execute script in Basic (only function and sentences documented in last page of this help).
Syntax: ExeBasic StringCode, Handle, Mode
Where StringCode is a variable with the code to execute, Handle may be set to 0 and is for future use. Mode may be set to 0 or 1 (0=initialize 1=preserve variables). If Mode is set to 0 then clear or initialize all in memory. If is set to 1 then preserve variables but initialize number of lines and buffers internally.
SetValue()
Set a value in a numeric variable.
Syntax: SetValue VarName, Value, Mode
VarName must be a variable name of numeric type. For example a name of numeric variable may be VARNUM#. Value must have the numeric value to set variable. Mode is for clear or preserve previous values of other variables.
SetTextValue()
Set a value in a string variable.
Syntax: SetTextValue VarName, stringValue, Mode
VarName must be a variable name of string type. For example a name of string variable may be VARNUM$. stringValue must have the value for set text variable. Mode is for clear or preserve previous variables.
GetValue()
Get value from a numeric variable.
Syntax: GetValue(VarName)
Return the value of a numeric variable. By example: RESULT=GetValue(“VARNUM#”)
GetTextValue()
Get value from a string variable.
Syntax: GetTextValue(VarName)
Return the value of a string variable. By example: RESULT$=GetTextValue(“VARNUM$”)
SetMaxVariables()
Syntax: SetMaxVariables maxvar
Allow set the max number of variables availables example: SetMaxVariables 1000
SetMaxLines()
Syntax: SetMaxLines maxlines
Allow set the max number of lines availables example: SetMaxLines 1000
The next list is all functions and sentences that is possible execute:
CLOSE #
DATEDIF()
EOF()
FIELD #
FORMAT$()
GET #
CLOSE #
DATEDIF()
EOF()
FIELD #
FORMAT$()
GET #
GETCLIPBOARDTEXT
GETFOCUS
GETTEXT
GOSUB
GOTO
IF()
INPUT #
LCASE$()
LEFT$()
LEN()
LINE INPUT #
LOF()
LSET$()
LTRIM$()
MCASE$()
MID$()
MSGBOX
NUMLETRA()
OPEN
PARSE$()
PRINT #
PUT #
RES_FECHA()
RETURN
RIGHT$()
RSET$()
RTRIM$()
SETCLIPBOARDTEXT
SETFOCUS
SETTEXT
STOP
STR$()
SUM_FECHA()
TRIM$()
UCASE$()
VAL()
WRITE #
Restriction:
It does not support nested functions, if you want to use a function you must run it separately.
THIS SOFTWARE CONTAINED HEREIN IS PROVIDED 'AS IS' AND COMES WITH NO WARRANTIES OF ANY KIND.