Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

Check if application is running, launch it if not

Description
This script will check if the specified process is already running and if not, it will launch it.
Language
C#.net
Minimum Version
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Dec 30, 2020
Date Last Modified
Dec 30, 2020

Scripted Function (Macro) Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
        // Set the process name here (leave the asterisk at the start)
        string processName = "*ts3client_win64.exe";
        
        // Set the full path to the process here
        string processFullPath = @"D:\APPS\TSClient\ts3client_win64.exe";
		
		// Check if the app is running
		bool isAppRunning = BFS.Application.IsAppRunningByFile(processName);
		if (isAppRunning)
		{
            // If it's already running, show a message
            BFS.Dialog.ShowMessageInfo("App is already running");
		}
		else
		{
            // If it's not, then launch it
            BFS.Application.Start(processFullPath, "");
		}
	}
}