# AUI\_ENVIRONMENT
> [HTML Version](aui_environment.htm)
**xcall AUI, AUI\_ENVIRONMENT, opcode, guiflags**
The AUI\_ENVIRONMENT class keeps track of properties and capabilities of the interface environment that affect the kind of user interface a program should use.
**Parameters**
_opcode_ ([Num](num.htm.md)) \[in\]
0 to retrieve the current attributes into guiflags, 1 to set them from guiflags. As a practical matter, you would probably never use opcode 1 since the flags are set automatically by A-Shell when the session is launched, and changing a flag isn't going to change the reality of the environment. Opcode 2 is a streamlined variation of 0 that skips the query of the ATE client to find out if it has Windows theme support or not. That detail is rarely of interest to applications; eliminating the query saves a few milliseconds for the round-trip query-and-response, although it probably makes little difference unless the application makes a lot of these calls.
_guiflags _([Num](num.htm.md)) \[in/out\]
Values for _guiflags _are shown in the following table, and are defined in [ashell.def](ashell_def.htm.md).
| | | |
|------|------|------|
| **Symbol** | **Value** | **Description** |
| AGF\_LWG | \&h0001 | Local Windows w/ GUI (e.g. PCTDVG) |
| AGF\_LWN | \&h0002 | Local Windows w/o GUI (e.g. PCTDV) |
| AGF\_ATE | \&h0004 | Running on server via ATE connection |
| AGF\_RWN | \&h0008 | Remote windows (ATS) |
| AGF\_TNT | \&h0010 | Telnet |
| AGF\_ASH | \&h0020 | A-Shell |
| AGF\_THEMES | \&h0040 | Windows Themes are active |
| AGF\_HOLDKBD | \&h0080 | Client currently holding kbd |
| AGF\_ATERES | \&h0100 | Currently waiting on ATE response |
| AGF\_LOCWIN | \&h0003 | Local Windows (AGF\_LWN or AGF\_LWG) |
| AGF\_ANYWIN | \&h000B | Any windows platform (\_LWN or \_LWG or \_RWN) |
| AGF\_GUIEXT | \&h0005 | GUI extensions avail (AGF\_LWG or AGF\_ATE) |
| AGF\_LWNATE | \&h0007 | Local Windows or ATE |
| AGF\_ATECLI | \&h0200 | Running on ATE client (i.e. inside TELNET.LIT) |
| AGF\_INPROC | \&h0400 | TAB(-10,x) command in progress |
| AGF\_ATESBX | \&h1000 | We are in ATE-side SBX call |
| [AGF\_NOSTATUS](agf_nostatus.htm.md) | \&h2000 | Disable the return of _cstatus_ information |
| AGF\_DESIGN | \&h10000 | Design mode |
**Comments and Examples**
All of these would start with retrieving the current _guiflags_ as follows:
xcall AUI, AUI\_ENVIRONMENT, 0, GUIFLAGS \! retrieve GUI flags
Before creating a graphical user interface with components from the AUI CONTROL class, you might want to check for either AGF\_LWG or AGF\_ATE. Since these are combined in AGF\_GUIEXT, we can simply check it as follows:
if (GUIFLAGS and AGF\_GUIEXT) then ? TAB(-10,x);.....
If you wanted to display a file for the user, either using NOTEPAD (if applicable) or else EZTYP (if not), you might use the following logic:
if (GUIFLAGS and AGF\_LOCWIN) then
xcall HOSTEX,"NOTEPAD "+F\$
elseif (((GUIFLAGS and AGF\_ATE)#0) and ((GUIFLAGS and AGF\_TNT)#0)) then
call XFER'TO'PC
call LAUNCH'NOTEPAD'ON'CLIENT
else
xcall EZTYP,F\$
endif
In the above example, if running Windows locally, we can just launch NOTEPAD using [HOSTEX](hostex_sbr.htm.md). Otherwise, if running ATE on the client over telnet, we could transfer the file to the PC and then launch NOTEPAD, both of which could be done via Tab(-10,x) commands. Otherwise, we could just use EZTYP on the server. (You might also want to test for other telnet emulators, such as ZTERM, which are capable of doing file transfers and launching commands on the client, but that exceeds the scope of this example.) Note that when testing multiple AND conditions, you need the extra set of parentheses and the #0 test as shown above to get the desired effect. Otherwise the confusion between the logical and arithmetic AND in BASIC will cause the test to fail.
If you merely wanted to test whether you were running under A-Shell Windows or A-Shell/Unix (or some other platform, presumably AMOS), you could do this:
if (GUIFLAGS and AGF\_ASH) then \! running A-Shell
if (GUIFLAGS and AGF\_ANYWIN) \! any Windows platform
? "A-Shell Windows"
else
? "A-Shell Unix"
endif
else
? "Non A-Shell (AMOS?)"
endif
**History**
2006 January, A-Shell 4.9.949: The following will return the ATE version if the fourth parameter is specified and the client is ATE.
xcall AUI, AUI\_ENVIRONMENT, 0, FLAGS \{,ATEVER\$\}