Introduction
The SystemInformation script function library consists of two files:
- SystemInformation.dll
- SystemInformation.wdf
This library provides the InTouch HMI® application developer with the ability to obtain system data from both local and accessible remote nodes.
As a general rule these functions will take about 1 second to complete if accessing local data. If obtaining data from a remote machine it can take even longer. For this reason these functions should be executed from an asynchronous QuickFunction so as not to inhibit other processing by InTouch.
Download the SystemInformationScripts.zip file.
- Unzip the SystemInformation.zip file.
- Copy the SystemInformation.dll and SystemInformation.wdf files and place them in your InTouch Install directory.
The functions will then be available from scripts when running WindowMaker.
Description
This library currently consists of three script functions:
- SINumberOfCPUs( “TargetNodeName”, “UserName”, “Password”, “Domain”)
- SICPULoadPercent( “TargetNodeName”, ZeroBasedCPUNumber, “UserName”, “Password”, “Domain”)
- SIIsProcessRunning( “TargetNodeName”, “ProcessName”, “UserName”, “Password”, “Domain”)
Use
SINumberOfCPUs( “TargetNodeName”, “UserName”, “Password”, “Domain”)
This function is used to determine the number of processors installed. It can be used in conjunction with the SICPULoadPercent() function to iterate through the processors and read the CPU load of each.
Example
NumCPUs = SINumberOfCPUs( “TargetNodeName”, “UserName”, “Password”, “Domain”)
- TargetNodeName is the machine name to be queried. This can be blank “” or “localhost” for the local machine or the name of a network computer.
- UserName is only required if querying another machine. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine. For a remote node a local or domain account user name is required.
- Password is only required if querying another machine. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine. For a remote node a valid password is required for the account specified.
- Domain is only required if querying another machine. This is the name of the domain if a domain account is used or the node name if a local account is used. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine.
SICPULoadPercent( “TargetNodeName”, ZeroBasedCPUNumber, “UserName”, “Password”, “Domain”)
This function is used to acquire the average CPU load for the specified processor on a specified node over the last second.
Example
CPULoad = SICPULoadPercent( “TargetNodeName”, ZeroBasedCPUNumber, “UserName”, “Password”, “Domain”)
- TargetNodeName is the machine name to be queried. This can be blank “” or “localhost” for the local machine or the name of a network computer.
- ZeroBasedCPUNumber is the number of the CPU to be read, with 0 being the first CPU. Currently released versions of InTouch run only on CPU0. A machine with 2 CPUs will have CPU0 and CPU1. For single processor machines zero is the only valid entry for this field. If an invalid processor number is entered a -1 will be returned.
- UserName is only required if querying another machine. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine. For a remote node a local or domain account user name is required.
- Password is only required if querying another machine. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine. For a remote node a valid password is required for the account specified.
- Domain is only required if querying another machine. This is the name of the domain if a domain account is used or the node name if a local account is used. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine.
SIIsProcessRunning( “TargetNodeName”, “ProcessName”, “UserName”, “Password”, “Domain”)
This function is used to determine if a process is running on the local or a specified and accessible remote node. The return value of this function is 0 if the process is not running or the number of instances currently running.
Example
NumInstances = SIIsProcessRunning( “TargetNodeName”, “ProcessName”, “UserName”, “Password”, “Domain”)
- TargetNodeName is the machine name to be queried. This can be blank “” or “localhost” for the local machine or the name of a network computer.
- ProcessName is the name of the process of interest as it would show in the Task Manager.
- UserName is only required if querying another machine. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine. For a remote node a local or domain account user name is required.
- Password is only required if querying another machine. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine. For a remote node a valid password is required for the account specified.
- Domain is only required if querying another machine. This is the name of the domain if a domain account is used or the node name if a local account is used. For local machine, “” should be supplied for clarity since this field is ignored when reading the local machine.