Jump to content

How to kill a "Not Responding" process?


Recommended Posts

I'm on Windows 10.

I have Firefox browsers running and sometimes one or more of them get stuck on "Not Responding".

12.PNG.cdc1992e4408d564327c9ac667126333.PNG

I would like for a way to monitor all the browsers, or do a check every X minutes, and if any of the programs is "Not Responding", to kill it.

 

I found this here and tried it - https://stackoverflow.com/questions/21532437/killing-all-non-responding-applications-with-autoit

Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase


; Wait 10 seconds for the a window to appear.

Local $hWnd = WinWait("Not Responding", "", 10)


; Wait for 2 seconds before calling the WinKill function.

Sleep(2000)


; Kill the window using the handle returned by WinWait.

WinKill($hWnd, "")

So my understanding is that this checks the title of the browsers, and if it finds "Not Responding" in any browser's title, it kills it.

This actually works on a browser that's normally running. But if a browser is stuck on "Not Responding", then it doesn't work :(

I assume this is because if a browser is stuck, then the code above is unable to read the window title.

The Stackoverflow thread where I got this solution is from 2014, so perhaps this worked back then for a program that's "Not Responding", but now it doesn't. I don't know.

---

I'm thinking perhaps the Task Manager can be used, and the "Not Responding" that's showing there. So something like:

  1. You run AutoIT script
  2. Script does a check on all (or some specific) task manager processes twice, with 30 seconds apart (to eliminate false positives)
  3. The processes that are "Not Responding" on both checks, kill them

Can it be done?

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...