IsNodeAppRunning Function

Posted on 174 views

Description

IsNodeAppRunning() allows the user to determine from an InTouch® script if a program is running on the local computer or on a remote computer.

Use

IsNodeAppRunning(ComputerName, ProgramName);

ComputerName This can be an empty string for the name of the local computer, or the full name of the local computer.  It must be the name of a remote computer to obtain information for a remote computer.  You can get a computer’s name by right-clicking on the ‘My Computer’ icon on the desktop, then selecting ‘Properties’ from the menu.  Go to the ‘Network Identification’ tab, and read the ‘Full Computer Name’.  A memory message tag can be used in place of a hard-coded string.
ProgramName This must be the name of the executable file for the local computer.  For a remote computer, it is the process name.  The process name is usually the same name that appears in the Task Manager list of processes.  In either instance, remove any file extension from the name, such as ‘.Exe’.  For example, if OutLook.Exe appears in task manager, then use the program name ‘OutLook’ when calling this script function. A memory message tag can be used in place of a hard-coded string.

Returns

Returns an integer value. The return value is greater than zero (typically 1) to indicate the program is running.  The return value is 0 to indicate that the program is not running.  Any return value less than 0 is to be interpreted as an error, meaning that the status of the program could not be determined.  If you specify the name of a process or program that is not found, and there are no other errors, you will get the return value of 0.  The return value can be assigned to a memory integer tag.

Installing the IsNodeAppRunning() Function

Download the IsNodeAppRunning.zip file

Extract the files WW2kscriptfuncs.dll and WW2kscriptfuncs.wdf. The WW2KScriptfuncs.Dll and WW2KScriptfuncs.Wdf files must be in the InTouch folder for this function to work correctly.  To use the function IsNodeAppRunning to determine if a program is running on the local computer, the PSAPI.Dll must be in the Windows/System32 folder on the local computer. This dynamic link library is already a part of Windows 2000® and Windows XP and it comes from Microsoft®. The file might need to be manually installed for the application detection function to work on Windows® NT, but this configuration is untested. The PSAPI.Dll is not necessarily installed by InTouch, Archestra, or the FactorySuite Common Components installations.

Example of Using IsNodeAppRunning()

The following is a script that determines if OutLook is running on the local computer:

iStatus = IsNodeAppRunning( “”, “OutLook” );

The following is a script that determines if OutLook is running on a remote computer:

iStatus = IsNodeAppRunning ( “RemoteNode1”, “OutLook” );

Probable Reasons For Failure

There are many reasons this function can fail and return a value of less than 0, and this list attempts to document some of them:

  • The remote computer is not currently running.

  • The remote computer name is invalid.

  • The account from which the function call was made does not have sufficient security to make network requests or to access the performance data information on the remote node.

  • There is insufficient memory to complete the request.

  • The PDH.Dll or PSAPI.Dll dynamic link library files are not located on the local computer or in the path where they can be dynamically loaded.  If installed properly, they are typically in the Windows\System32 folder.

Leave a Reply

Your email address will not be published. Required fields are marked *

− 3 = 3