Skip to main content
InSource Solutions

TN AppSvr319 How to check to see if an application is running from within a Wonderware Application Server script

InSource_Logo_Transparent.png

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

 

  1. Create a boolean attribute to hold the result. In this example, I have created an object named ViewRunning and a boolean attribute called test.

Capture1.JPG

 

  1. Click the Scripts tab to add a script to the object.

Capture2.JPG

 

  1. 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.

Capture3.JPG

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;