GetEnvironment PowerScript function
Description
Gets information about the operating system, processor, and
screen display of the system.
Syntax
|
1 |
<span>GetEnvironment</span> ( <span>environmentinfo</span> ) |
|
Argument |
Description |
|---|---|
|
environmentinfo |
The name of the Environment object that |
Return Values
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
This script runs another PowerBuilder application
and uses the OSType property of the Environment object to determine
how to specify the path:
|
1 |
string path |
|
1 |
environment env |
|
1 |
integer rtn |
|
1 |
|
1 |
rtn = GetEnvironment(env) |
|
1 |
IF rtn <> 1 THEN RETURN |
|
1 |
|
1 |
CHOOSE CASE env.OSType |
|
1 |
CASE aix! |
|
1 |
path = "/export/home/pb_apps/analyze.exe" |
|
1 |
CASE Windows!, WindowsNT! |
|
1 |
path = "C:PB_appsanalyze.exe" |
|
1 |
CASE ELSE |
|
1 |
RETURN |
|
1 |
END CHOOSE |
|
1 |
Run(path) |
This example displays a message box that shows the
major, minor, and fixes versions and the build number of PowerBuilder:
|
1 |
string ls_version<br>environment env<br>integer rtn<br> <br>rtn = GetEnvironment(env)<br> <br>IF rtn <> 1 THEN RETURN<br>ls_version = "Version: "+ string(env.pbmajorrevision)<br>ls_version += "." + string(env.pbminorrevision)<br>ls_version += "." + string(env.pbfixesrevision)<br>ls_version += " Build: " + string(env.pbbuildnumber)<br> <br>MessageBox("PowerBuilder Version", ls_version) |