TN AppSvr319 How to check to see if an application is running from within a Wonderware Application Server script
Description
This article from InSource contains a simple example of utilizing .Net to check to see if an application is running from within a Wonderware Application Server script.
- Author: Joseph Hefner
- Published: 02/04/2019
- Applies to: Wonderware Application Server 2014 R2 and above.
Details
- Create a boolean attribute to hold the result. In this example, I have created an object named ViewRunning and a boolean attribute called test.
- Click the Scripts tab to add a script to the object.
- Add a script to call the System.Diagnostics.Process.GetProcessByName method to determine whether or not the application is running. In this example, the script will run every 10 seconds and check to see if the process named "view" is running.
The script above can be copied below:
dim pName[100] as System.Diagnostics.Process;
pName = System.Diagnostics.Process.GetProcessesByName("view");
if(pName.Length > 0)then
Me.test = true;
else
Me.test = false;
endif;