Skip to content
Petr Schreiber edited this page Mar 12, 2016 · 8 revisions

You can use this module to manage your process level environment variables.

How to start using it

Place the thinBasic_enVar.dll to Mod directory inside your thinBasic installation. Since then, you should be able to reference the module easily as:

uses "enVar"

Examples of usage

The usage is very straightforward - no objects, no complex types, just a bunch of simple commands:

' -- Sets value of MyVariable to MyValue
enVar_Set "MyVariable", "MyValue" 

' -- Retrieves the value of given variable
String s = enVar_Get "MyVariable" 

' -- Returns comma separated list of environment variables
String s = enVar_List 

' -- Returns list of environment variables, separated by user specified string
String s = enVar_List(";") 

' -- Erases the specified variable
enVar_Remove "MyVariable"

' -- Returns non-zero value in case the variable does exist
enVar_Exists "MyVariable"

' -- Set a variable with comma separated values
envVar_Set "MyCars", "Tesla Model S,Ferrari 512GT"

Long nCars = envVar_GetItemCount "MyCars" ' -- Presumes comma, returns 2
nCars = envVar_GetItemCount "MyCars", "," ' -- Explicit separator, returns 2

String firstCar  = envVar_GetItem "MyCars", ",", 1 ' -- Returns "Tesla Model S"
String secondCar = envVar_GetItem "MyCars", ",", 2 ' -- Returns "Ferrari 512GT"

##Where to get support Please join us at the heart of ThinBASIC - at official forums. There is dedicated discussion.

Clone this wiki locally