EXECUTE                                                             Statement

EXECUTE(string)

EXECUTE("file:|ascii:|unicode:" & string) NSEXECUTE("file:|ascii:|unicode:" & string)

Description

EXECUTE executes an expression or file as if it were code substituted in the program. The required parameter, string, can be either a string expression or the name of a file containing statements that is executed. If multiple statements are to be executed, separate them with a carriage return (vbCRLF). The code can access and modify all variables in the current running program.

If the string starts with "file:" or "ascii:", the rest of the string is used as a pathname to an ascii file. If the string starts with "unicode:" it refers to a file in unicode format. The filename feature is only available at development NS Basic/CE - not the Runtime version.

NSEXECUTE works the same way as EXECUTE, but objects created using ADDOBJECT will send events back to your program.

Example

REM EXECUTE execute a string as a SUB

DIM x

x = 5

EXECUTE("PRINT x * 10")

EXECUTE("x = x * 10")

'text.txt is a file with "PRINT 50" in it

EXECUTE("ascii:\my documents-est.txt")

PRINT x

Output

50

50

50110

Related Items

EVAL, EXECUTEGLOBAL