Created
November 1, 2017 06:23
-
-
Save CNG/8e89020061da23d582c49742e5b88130 to your computer and use it in GitHub Desktop.
Kill unresponsive app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Activity Monitor" to run --We need to run Activity Monitor | |
tell application "System Events" to tell process "Activity Monitor" | |
tell radio button 1 of radio group 1 of group 2 of toolbar 1 of window 1 to click --Using the CPU View | |
tell outline 1 of scroll area 1 of window 1 -- working with the list | |
set notResponding to rows whose value of first static text contains "Insync (Not Responding)" -- Looking for Not responding process | |
repeat with aProcess in notResponding | |
set pid to value of text field 5 of aProcess -- For each non responding process retrieve the PID | |
if pid is not "" then do shell script ("kill -9 " & pid) -- KILL the PID. | |
end repeat | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment