using System; using System.Drawing; public static class VoiceBotScript { public static void Run(IntPtr windowHandle) { // Launch the application uint appID = BFS.Application.Start(@"C:\Windows\Notepad.exe"); // Wait up to 10 seconds for it to finish launching for (int i = 0; i < 10; i++) { // If the window doesn't exist, wait 1 second and try again if (BFS.Application.GetMainWindowByAppID(appID) == null) BFS.General.ThreadWait(1000); // Otherwise, break out of the loop else break; } } }