Env$: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(edit)
 
No edit summary
Line 1: Line 1:
The '''Env$''' [[internal function]] returns the current value of the [[DOS]] or [[Unix]] / [[Linux]] environment variable A$. The Env$ function can be used to obtain the value of any user-created or system- created environment variable that can be displayed with the operating system's SET (or set) command. To see a list of these variables, enter the SET command with no parameters at the operating system prompt.
The '''Env$(var$)''' returns the current value of the environment variable var$. The Env$ function can be used to obtain the value of any user-created or system-created environment variable that can be displayed with the operating system's SET (or set) command. To see a list of these variables, enter the SET command with no parameters at the operating system prompt.


The '''Env$''' [[internal function]] is used to retrieve an [[environmental variable]]'s value which was set with [[SetEnv]] or inherited from window's environmental variables.
The '''Env$''' function is used to retrieve an [[environmental variable]]'s value which was set with [[SetEnv]] or inherited from Windows' environmental variables.


i.e.
Example:
  got1$=env$("[[UserName]]")
 
  got2$=env$("[[GUIMode]]")
got1$=env$("[[UserName]]")
got2$=env$("[[GUIMode]]")


Additionally the status command showing all set environmental variables is:
Additionally the status command showing all set environmental variables is:
Line 11: Line 12:
  [[Status]] Env
  [[Status]] Env


The Env$ internal function cannot be set or altered by CONFIG SETENV.
The Env$ internal function can be set by CONFIG SETENV. For example, use the following command to set the value of env$("librarypath"):


config setenv librarypath f:\apps\library\


Env$(A$)
Operating system ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.


====Comments and Examples====


====Comments and Examples====
As an example, if LOGNAME contains the login name, the following line in a menu program would require a user to log in as "root" to be able to run program PROG14.
As an example, if LOGNAME contains the login name, the following line in a menu program would require a user to log in as "root" to be able to run program PROG14.


Line 23: Line 25:


====Technical Considerations====
====Technical Considerations====
:1.) Unix / Linux versions of Business Rules require that user-created environment variables be passed by an export command to the operating system before the user enters Business Rules . Otherwise, the values of these variables cannot be returned by ENV$.
 
# Unix / Linux versions of Business Rules require that user-created environment variables be passed by an export command to the operating system before the user enters Business Rules . Otherwise, the values of these variables cannot be returned by ENV$.


====Env$("GUIMode")====
====Env$("GUIMode")====


There is a BR provided Env$ variable called GUIMODE (case insensitive). It's value is either ON or OFF depending on whether BR is in GUI mode. System ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.
There is a BR provided Env$ variable called GUIMODE (case insensitive). It's value is either ON or OFF depending on whether BR is in [[GUIMode|GUI mode]]. System ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.





Revision as of 10:33, 24 January 2012

The Env$(var$) returns the current value of the environment variable var$. The Env$ function can be used to obtain the value of any user-created or system-created environment variable that can be displayed with the operating system's SET (or set) command. To see a list of these variables, enter the SET command with no parameters at the operating system prompt.

The Env$ function is used to retrieve an environmental variable's value which was set with SetEnv or inherited from Windows' environmental variables.

Example:

got1$=env$("UserName")
got2$=env$("GUIMode")

Additionally the status command showing all set environmental variables is:

Status Env

The Env$ internal function can be set by CONFIG SETENV. For example, use the following command to set the value of env$("librarypath"):

config setenv librarypath f:\apps\library\

Operating system ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.

Comments and Examples

As an example, if LOGNAME contains the login name, the following line in a menu program would require a user to log in as "root" to be able to run program PROG14.

00040 if env$("LogName")="root" then chain "Prog14" else goto SHOWMENU

Technical Considerations

  1. Unix / Linux versions of Business Rules require that user-created environment variables be passed by an export command to the operating system before the user enters Business Rules . Otherwise, the values of these variables cannot be returned by ENV$.

Env$("GUIMode")

There is a BR provided Env$ variable called GUIMODE (case insensitive). It's value is either ON or OFF depending on whether BR is in GUI mode. System ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.