cancel
Showing results for 
Search instead for 
Did you mean: 

Wait loop until Task Manager application status <> Not Responding

PierceClements
Level 3
Hi everyone,

I'm targeting an application (Objective ECM - desktop client)  which can adjust from responsive to "Not Responding" after certain values or actions are taken. This is due to server response times from action.

Luckily Windows Task Manager reliably shows the application status as Not Responding. Unfortunately I do not know how to target this status easily and googling is not helping. I would like to build a code stage that looks at this task manager detail and reports the current status.

This way I can build a wrapper for my team to target any application by data item input and use a ~120 count loop to wait up to two (2) minutes for the application to become responsive again. 

Your help is extremely appreciated. If the idea already exists in BP standard utility logic, I cannot see it.
4 REPLIES 4

John__Carter
Staff
Staff
You could try using the System.Diagnostics.Process.Responding property in a code stage to detect whether the user interface is responding.

Or, depending on the application and its behaviour, it might be possible to read or wait for some indicator from the screen using a VBO. But often this won't work because BP requires the app to be responsive in order to interact with it, so you're stuck in a catch 22.

Walter.Koller
Level 11
There are several approaches, depending which programming technique you prefer. 

One option is to use old style cmd line, which might be easier if you are not too deep into programming:
tasklist /FI "STATUS eq NOT RESPONDING" /FI "IMAGENAME eq chrome.exe"
You might have to add some steps to catch and parse the results and exclude filtered results from non-existing processes.

I am sure there is something similar (very likely better) in PowerShell.

PierceClements
Level 3
Thanks @John Carter @Walter Koller,

Using the System.Diagnostics.Process.Responding property in a code stage to detect whether the user interface is responding. 
This seems like a great idea. I'm quite experienced with VBA and okay at C++, however no experience in C# syntax or BP's likely varied C# syntax.
I've googled but am in over my head without taking a 5-10hr LinkedIn/Udemy C# course. Any suggestions on a starter code block, or template to adapt?

Using CMD linetasklist /FI "STATUS eq NOT RESPONDING" /FI "IMAGENAME eq chrome.exe"
After some particular actions from BP I would like to poll the status every 5 seconds and loop until status <> "Not Responding". BP will handle kill process logic based off max loop. I think using CMD would be causing my system a hassle, and BP as I'd be shifting active windows; either using CMD itself, or Windows "Run" program.

I think coding is the cleanest way, as the system is aware of the responsiveness with or without Task Manager open, meaning I should be able to poll and call the current status without opening any additional applications.
​​

PSSupport
Staff
Staff
Hi Pierce - these aren't exactly what you're looking for but you'll get the idea. GetProcesses or GetProcessesByName gives you a list of process objects that you loop through and check the value of the objProcess.Responding property.

https://stackoverflow.com/questions/320645/check-status-of-process
https://www.delftstack.com/howto/csharp/csharp-check-if-process-is-running/

You'll also be able to try Walter's suggestion with a silent call using the Utility Environment VBO
36833.png