OPTION ENVIRONMENT |
OPTION ENVIRONMENT "variable-name" value OPTION ENVIRONMENT "variable-name" REMOVE
First format creates and/or sets the value of an environment variable. Environment variables created at the top level will have a life of the host applications so it can be used to store handles to files or shared memory that is needed by multiple script files that are not executed in the same interpreter.
The second format will clear or remove/delete an existing variable.
Example:
OPTION ENVIRONMENT "Kalle Anka", "Hello?"
DIM file AS INTEGER file = FILE.Open( "c:\nils.txt" ) IF file > 0 THEN OPTION ENVIRONMENT "Nils" file ENDIF
file = ENVIRONMENT( "Nils" ) FILE.Close( file )
OPTION ENVIRONMENT "Kalle Anka" REMOVE
' Note; Environment Variable "Nils" is still active and ' can be used by other programs executed in the ' main MyBASIC2 environment
END
|