GetEnvironment

Description

Gets information about the operating system, processor, and screen display of the system.

Syntax

GetEnvironment ( environmentinfo )

Argument

Description

environmentinfo

The name of the Environment object that will hold the information about the environment

Returns

Integer. Returns 1 if it succeeds and -1 if an error occurs. If environmentinfo is null, GetEnvironment returns null.

Usage

In cross-platform development projects, you can call GetEnvironment in scripts and take actions based on the operating system. You can also find out the processor (Intel 386 or 486, 68000, and so on). The information also includes version numbers of the operating system and PowerBuilder.

You can call GetEnvironment to find out the number of colors supported by the system and the size of the screen. You can use the size information in a window’s Open script to reset its X and Y properties.

Examples

Example 1

This script runs another PowerBuilder application and uses the OSType property of the Environment object to determine how to specify the path:

string path

environment env

integer rtn


rtn = GetEnvironment(env)

IF rtn <> 1 THEN RETURN


CHOOSE CASE env.OSType

CASE aix!

    path = "/export/home/pb_apps/analyze.exe"

CASE Windows!, WindowsNT!

    path = "C:\PB_apps\analyze.exe"

CASE ELSE

    RETURN

END CHOOSE

Run(path)

Example 2

This example displays a message box that shows the major, minor, and fixes versions and the build number of PowerBuilder:

string ls_version
environment env
integer rtn

rtn = GetEnvironment(env)

IF rtn <> 1 THEN RETURN
ls_version = "Version: "+ string(env.pbmajorrevision)
ls_version += "." + string(env.pbminorrevision)
ls_version += "." + string(env.pbfixesrevision)
ls_version += " Build: " + string(env.pbbuildnumber)

MessageBox("PowerBuilder Version", ls_version)