getcfg

(getcfg profile_name)

The getcfg function retrieves application data from the [AppData] section of the appdata.ini file. The appdata.ini file is a general-purpose parameter file located in the system's configuration directory. To get the name of the configuration directory, use the getenv function, which returns a list including a CADCFG dotted pair list containing the path.

Arguments

The profile_name argument specifies the name of the variable to be read. It passes a string containing the Section Name(s) and the Parameter Name to be retrieved to the function. The argument Profile_Name must be a string in the form:

"AppData/[ProfileSection]/[SubSection]/[...]/Parameter"

Note, that the string must start with "AppData/".

The use of capitalization within the profile_name string is irrelevant.

Return Value

The function returns the current value of the parameter in a string. If the profile_name argument is invalid, the function returns nil.

Note: If the file appdata.ini does not yet exist in the program's configuration directory, it is created the first time the setcfg function is performed.

Examples

: (getcfg "appdata/myapp/par_1")

"2.54"

: (getcfg "appdata/myapp/mysection/par_2")

"OFF"

: (getcfg "appdata/par_3")

"2"

Related Functions

setcfg, getenv, getvar, setvar, findfile

The setcfg function writes application specific data (parameters) to individual sections of the appdata.ini file.