Promotic
WikipediaLinkedInYoutubeTwitterFacebook

GetSystemInfo - method of the Pm object

Description:
Returns the system information.
Syntax:
Variant GetSystemInfo(String sWhat, String sParams)
Parameters:
sWhat(String) Obtained information identifier. The basic option defining what to return.
"screen.width" - Returns the width of the display (in pixels).
The sParams parameter is not used.
See Example1.
"screen.height" - Returns the height of the display (in pixels).
The sParams parameter is not used.
See Example1.
"screen.clientarea.width" - Returns the width of the client area of the display (OS Windows toolbar not included) (in pixels).
The sParams parameter is not used.
"screen.clientarea.height" - Returns the height of the client area of the display (OS Windows toolbar not included) (in pixels).
The sParams parameter is not used.
"screen.allmonitors" - Returns position and total size of circumscribe rectangle around all displays (in pixels) in the form of PmMap. PmMap contains properties x, y, dx and dy defining the position and size.
The sParams parameter is not used.
"app.zoom" - Returns a value of magnification/minification factor of the whole application as a result of adapting to the resolution of the display compared to the original application.
See the "Application appearance zoom" configurator.
The sParams parameter is not used.
"screensaver.active" - Returns the flag indicating whether or not is the screensaver active (not the dispay sleep mode).
The sParams parameter is not used.
"memory.free" - Returns a value of free system memory in kB (with the precision of 4 kB).
It is often handy to monitor this value when tuning the application.
The sParams parameter is not used.
"memory.usage" - Returns the size of used system memory in kB (with the precision of 4 kB).
The computer memory usage can also be detected in the "/System/Memory" item of the INFO system.
See also Monitoring running PROMOTIC application.
It is often handy to monitor this value when tuning the application.
The sParams parameter is not used.
"cpu.usage" - Returns a value of average CPU load in percentage. The value represents the average load of all CPU cores since the last calling of this method.
It is often handy to monitor this value when tuning the application.
The sParams parameter is not used.
"win.username" - Returns the name of currently logged-in OS Windows user.
The sParams parameter is not used.
"win.starttime" - Returns Windows launch time.
The sParams parameter is not used.
"app.starttime" - Returns application launch time.
The sParams parameter is not used.
"app.lastuseracttime" - Returns the time of last user activity (keyboard or mouse). This method is also functional in Web panels.
This detection can be performed periodically and if the user inactivity reaches certain time then an action can be triggered (e.g. user logout).
The sParams parameter is not used.
See Example3.
"app.laststopfailed" - Returns true if the last application stopping ended with an error, otherwise returns false. (See the pEvent.Reset parameter in the onAppStartBegin event).
The sParams parameter is not used.
"net.addresses" - Returns an array of IP network addresses of this computer.
The sParams parameter in the KeyVal format specifies how the addresses are added into the array based on type. If not defined then all IPv4 and IPv6 addresses are returned (without localhost addresses).
See Example2.
"ipv4" (optional) - Specifies adding of IPv4 addresses into the array.
0 - No addresses of defined type are added.
1 (default) - Network addresses of defined type are added (without localhost).
2 - Adds localhost address 127.0.0.1 or ::1 according to defined type.
3 - Network and localhost addreses of defined type are added.
"ipv6" (optional) - Specifies adding of IPv6 addresses into the array.
0 - No addresses of defined type are added.
1 (default) - Network addresses of defined type are added (without localhost).
2 - Adds localhost address 127.0.0.1 or ::1 according to defined type.
3 - Network and localhost addreses of defined type are added.
"pm.platform" - Returns flag whether the PROMOTIC system is 32 bit (value 0) or 64 bit (value 1).
The sParams parameter is not used.
"pm.version" - Returns version of the PROMOTIC system in the form for example "PROMOTIC 9.0.16".
The sParams parameter is not used.
"tz.bias.standard" - Returns the time shift in minutes (bias) of the UTC time from the local standard time. For most of the Europe (zone UTC+1) the value is -60.
The sParams parameter is not used.
"tz.bias.daylight" - Returns the time shift in minutes (bias) of the UTC time from the local daylight saving time. For most of the Europe (zone UTC+1) the value is -120.
The sParams parameter is not used.
sParams(String) Additional parameters for each operation. The meaning is different for each operation.
If the operation uses the parameter, then it is pointed by the operation.
Note:
This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.
This method is also functional in Web panels. On the Web only the functions below are working:
- "screen" type option. Then the the method returns information (parameters of the display) on PC where the client (Web browser) is running.
Example1:
Obtains the display resolution:
JavaScriptVBScriptSelect and copy to clipboard

var nScreenX = Pm.GetSystemInfo("screen.width", "");
var nScreenY = Pm.GetSystemInfo("screen.height", "");
Example2:
Obtains array of network IPv4 addresses without localhost address:
JavaScriptVBScriptSelect and copy to clipboard

var aIpAddr = Pm.GetSystemInfo("net.addresses", "ipv4:1;ipv6:0;");
Example3:
Automated user logout after 10 minutes of inactivity. Script in the onRefresh event in PmgRoot panel that is permanently open in the application (for example in the toolbar). This method is also functional in Web panels.
JavaScriptVBScriptSelect and copy to clipboard

var nMinInactivity = 10;  //x minute
var nLastTimeActivity = Pm.GetSystemInfo("app.lastuseracttime", "");
var nTimeOut = Pm.Time - (1 / 24 / 60) * nMinInactivity;
if ( nTimeOut > nLastTimeActivity)
{
Pm.Debug("Auto LogOff");
Pm.Logoff();
}

History:
Pm9.00.05: New options:
- "app.lastuseracttime" returns the time of last user activity. Allows e.g. to disconnect the user after defined time period of inactivity. See Example3.
- "tz.bias.standard" returns the time shift (bias) between UTC and local standard time.
- "tz.bias.daylight" returns the time shift (bias) between UTC and local daylight saving time.
Pm9.00.03: New options:
- "net.addresses" returns array of IP addresses of the computer.
- "pm.platform" returns flag whether PROMOTIC is 32 bit or 64 bit.
- "pm.version" returns the version of the PROMOTIC.
Pm8.03.32: Bugfix (did not work in OS Windows XP)
Pm8.03.27: New option "screen.allmonitors" returns the size of all displays.
Pm8.03.03: New option "win.username" returns the name of currently logged-in OS Windows user.
Pm8.02.00:
- New operation "screensaver.active" allows to detect whether the screen saver is currently active.
- New operation "app.zoom" allows to read the application zoom (i.e. the value of the "Application appearance zoom" configurator).
Pm8.01.00: new options "memory.free", "memory.usage" and "cpu.usage" for checking the free memory, used memory and CPU load.
These options replacethe following properties Pm.MemoryUsage and Pm.CpuUsage, that are now considered obsolete (even if functional).
PROMOTIC 9.0.16 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- GetSystemInfo
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice