Processing Ajax...
Save 25% on our desktop apps during our Black Friday/Cyber Monday sale!Save 25% on our desktop apps during our Black Friday/Cyber Monday sale, including DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!Save 25% on our desktop apps during our Black Friday/Cyber Monday sale!

Title
Close Dialog

Message

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, "");
		}
	}
}