07-08-2023, 05:31 PM
Hi, I don't have QM and have never used it, but if you hand the task off to LA, maybe you could use this (untested, no way to test), and apologies if it's a wild goose chase. (I think the required 'using' directives are already global, but I'm not sure.)
string relaysProgramPath = @"C:\B.exe";
string arguments = "/start \"My arg\"";
Process.Start(relaysProgramPath, arguments);
// Set the upper limit of loop attempts and the interval time (in seconds)
int maxAttempts = 30;
int interval = 1;
// Loop to check the number of processes, maximum 30 attempts
for (int i = 1; i <= maxAttempts; i++) {
// Get the number of "A.exe" processes
Process[] processes = Process.GetProcessesByName("A");
int processCount = processes.Length;
// Check the number of processes
if (processCount <= 1) {
// If the number of processes is less than or equal to 1, break the loop
break;
}
// Wait for the specified interval time
Thread.Sleep(interval * 1000);
}
print.it("New A.exe has exited");