SetEnv: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The '''SetEnv''' [[internal function]] and [[config]] are used to set [[session]] based [[environmental variables]] in [[Business Rules!]].
The '''SetEnv''' [[internal function]] and [[config]] are used to set [[session]] based [[environmental variables]] in [[Business Rules!]].


In a [[brconfig.sys]] file you can set a BR environmental variable as follows:
In a [[brconfig.sys]] file you can set a BR environmental variable as follows:


  SetEnv FIELD VALUE
  SETENV <field> <value>


In a [[program]] you can set a BR environmental variable as follows:
In a [[program]] you can set a BR environmental variable as follows:


  SetEnv("FIELD","VALUE")  
  SETENV("<field","<value>")  


The value of either windows environmental variables or BR environmental variable may be accessed in a [[program]] or [[proc]] by using the [[Env$]] internal function.  For example:
The value of either windows environmental variables or BR environmental variables may be accessed in a [[program]] or [[proc]] by using the [[Env$]] internal function.  For example:


  Env$("FIELD")
  Env$("FIELD")


====Special Variables====


SetEnv("SCRN_SIZE_POSN") - case insensitive - will save the current screen size and position for both the new console and the command console, provided they are not minimized to the task bar. The positions of any window that is minimized (graphical window or command console) will not be saved.
====Environment Variable Simulation====
 
The [[Env$]] function, which is used to interrogate the BR environment, has been expanded to permit the ''simulation'' of setting an environment variable with configuration statements or with the SETENV system function. As indicated above, either a CONFIG command, or the BRCONFIG.SYS file may set a simulated environment variable:
 
CONFIG SETENV SIZE '10 x 24'
 
Also the SETENV system function can do the same thing:
 
SETENV("SIZE","10 x 24")


This allows a program to use ENV$("SIZE") to retrieve the value '10 x 24', excluding the quotes. In the event SIZE was previously defined in the environment it will be reset to the new value for the duration of the BR session. ENV$ is case insensitive so ENV$("SIZE"), ENV$("SiZe") or ENV$("size") will each produce the same result.
Operating System ENV$ variables cannot be set or altered by CONFIG SETENV.


====GUIMode====


{{:GUIMode}}
====SPECIAL VARIABLES====


====Icon====
====Scrn_Size_Posn====


{{:Icon}}
SetEnv("[[SCRN_SIZE_POSN]]") - case insensitive - will save the current screen size and position for both the new console and the command console, provided they are not minimized to the task bar. The positions of any window that is minimized ([[Open Window|graphical window]] or [[command console]]) will not be saved.


====Environment Variable Simulation====
As of 4.2, the use of SCRN_SIZE_POSN will also save the operator's insert/overstrike preference.


The [[Env$]] function, which is used to interrogate the BR environment, has been expanded to permit the simulation of setting an environment variable with configuration statements. The ENV$ function is case insensitive.


CONFIG SETENV SIZE '10 x 24'
====GUIMode====


This allows a program to use ENV$("SIZE") to retrieve the value '10 x 24', excluding the quotes. In the event SIZE was previously defined in the environment it will appear as set to the new value for the duration of the BR session.
{{:GUIMode}}


SetEnv("[[SCRN_SIZE_POSN]]") will save the current screen size and position for both the new console and the command console, provided they are not minimized to the task bar. The positions of any window that is minimized ([[Open Window|graphical window]] or [[command console]]) will not be saved.
====Icon====


Operating System ENV$ variables cannot be set or altered by CONFIG SETENV.
{{:Icon}}


===Clipboard===
===Clipboard===
Line 46: Line 53:
[[Category:Internal Functions]]
[[Category:Internal Functions]]
[[Category:Config]]
[[Category:Config]]
[[Category:Needs Help]]
[[Category:Environmental Variable]]
[[Category:Environmental Variable]]
</noinclude>
</noinclude>

Latest revision as of 20:08, 1 November 2017

The SetEnv internal function and config are used to set session based environmental variables in Business Rules!.

In a brconfig.sys file you can set a BR environmental variable as follows:

SETENV <field> <value>

In a program you can set a BR environmental variable as follows:

SETENV("<field","<value>") 

The value of either windows environmental variables or BR environmental variables may be accessed in a program or proc by using the Env$ internal function. For example:

Env$("FIELD")


Environment Variable Simulation

The Env$ function, which is used to interrogate the BR environment, has been expanded to permit the simulation of setting an environment variable with configuration statements or with the SETENV system function. As indicated above, either a CONFIG command, or the BRCONFIG.SYS file may set a simulated environment variable:

CONFIG SETENV SIZE '10 x 24'

Also the SETENV system function can do the same thing:

SETENV("SIZE","10 x 24")

This allows a program to use ENV$("SIZE") to retrieve the value '10 x 24', excluding the quotes. In the event SIZE was previously defined in the environment it will be reset to the new value for the duration of the BR session. ENV$ is case insensitive so ENV$("SIZE"), ENV$("SiZe") or ENV$("size") will each produce the same result.

Operating System ENV$ variables cannot be set or altered by CONFIG SETENV.


SPECIAL VARIABLES

Scrn_Size_Posn

SetEnv("SCRN_SIZE_POSN") - case insensitive - will save the current screen size and position for both the new console and the command console, provided they are not minimized to the task bar. The positions of any window that is minimized (graphical window or command console) will not be saved.

As of 4.2, the use of SCRN_SIZE_POSN will also save the operator's insert/overstrike preference.


GUIMode

There is a BR! provided GUIMode environmental variable (case insensitive). It's value is either ON or OFF depending on whether BR is in GUI mode.

x$=env$("GUIMode")

See also:

Env$ GUI Mode


Icon

The Icon environmental variable can be set during the execution of a program by use of SetEnv.

When the special Icon environmental variable is set it will change the icon which the business rules! application displays.

SetEnv("Icon","myicon.ico") sets the icon for the window and the taskbar to the icon specified by the second parameter (e.g. myicon).

00100 SetEnv('Icon','Myicon.ico')


Clipboard

The SetEnv command and the Env$ internal function enable programmatic access to the windows clipboard.

To set the windows clipboard use:

SETENV("CLIPBOARD" ,"<replacement-value>")

To read the windows clipboard use:

ENV$("CLIPBOARD")

These expressions stow and retrieve data to and from the Windows clipboard. The word 'clipboard' is case insensitive.