Promotic

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 (Windows OS toolbar not included) (in pixels).
The sParams parameter is not used.
"screen.clientarea.height" - Returns the height of the client area of the display (Windows OS 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 the PmMap object. 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 debugging the application.
The value can also be monitored in the INFO system (SYSTEM/#SYSTEM) or using Windows Task Manager.
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 How to monitor the running PROMOTIC application.
It is often handy to monitor this value when debugging the application.
The value can also be monitored in the INFO system (SYSTEM/#SYSTEM) or using Windows Task Manager.
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 this method.
It is often handy to monitor this value when debugging the application.
The value can also be monitored in the INFO system (SYSTEM/#SYSTEM) or using Windows Task Manager.
The sParams parameter is not used.
"objects.kernel.usage" - Returns the number of handles (Handle, KERNEL objects) of the process.
It is often handy to monitor this value when debugging the application.
The value can also be monitored in the INFO system (SYSTEM/#SYSTEM) or using Windows Task Manager.
The sParams parameter is not used.
"objects.gdi.usage" - Returns the number of GDI objects of the process.
It is often handy to monitor this value when debugging the application.
The value can also be monitored in the INFO system (SYSTEM/#SYSTEM) or using Windows Task Manager.
The sParams parameter is not used.
"objects.gdi.usage.peak" - Returns the maximum reached value of the number of GDI objects of the process.
It is often handy to monitor this value when debugging the application.
The value can also be monitored in the INFO system (SYSTEM/#SYSTEM) or using Windows Task Manager.
The sParams parameter is not used.
"objects.user.usage" - Returns the number of USER objects (User interface objects) of the process.
It is often handy to monitor this value when debugging the application.
The value can also be monitored in the INFO system (SYSTEM/#SYSTEM) or using Windows Task Manager.
The sParams parameter is not used.
"objects.user.usage.peak" - Returns the maximum reached value of the USER objects number (User interface objects) of the process.
It is often handy to monitor this value when debugging the application.
The value can also be monitored in the INFO system (SYSTEM/#SYSTEM) or using Windows Task Manager.
The sParams parameter is not used.
"win.lang" - Returns the language of currently logged-in user in Windows OS.
The sParams parameter is not used.
"win.rdp" - If the application is running via the remote desktop (RDP) then returns the 1 value, otherwise returns the 0 value.
The sParams parameter is not used.
"win.username" - Returns the name of currently logged-in user in Windows OS.
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 the true value if the last application stopping ended with an error, otherwise returns the false value. (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 "PROMOTIC9.0.27".
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 the computer 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

if (pMe.Root.ClientType == 2)
{
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();
}
}
Example4:
Switching the application language to the Windows OS user language:
JavaScriptVBScriptSelect and copy to clipboard

Pm.RtLang = Pm.GetSystemInfo("win.lang", "");

History:
Pm9.00.25: Fixed bug: The option "app.lastuseracttime" was not functional in the Web panel.
Pm9.00.19: New options:
- "objects.kernel.usage": Returns the number of handles (Handle, KERNEL objects) of the process.
- "objects.gdi.usage": Returns the number of GDI objects of the process.
- "objects.gdi.usage.peak": Returns the maximum reached value of the number of GDI objects of the process.
- "objects.user.usage": Returns the number of USER objects (User interface objects) of the process.
- "objects.user.usage.peak": Returns the maximum reached value of the USER objects number (User interface objects) of the process.
Pm9.00.18: New options:
- "win.lang" returns the language of the currently logged-in user in Windows OS.
- "win.rdp" returns flag indicating whether the application is running via the remote desktop (RDP).
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: Fixed bug: Did not work in Windows OS 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 user in Windows OS.
Pm8.02.00:
- New option "screensaver.active" specifies whether the screen saver is currently active.
- New option "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 detecting 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.27 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.