Monday, January 22, 2018

#1 2017-03-16 03:16:32 pm

Registered: 2017-03-16
Posts: 2

How to auto force quit an application not responding (but active)

I use application Isadora for a video installation running automatically. It appear that sometimes Isadora Freeze. In activity monitor it say "not responding" in red.

I have already some script to auto restart the application and the file:/ after a crash, an unexpected quit or simply if not active.

But when it become to freeze it still look active, even if not responding, so those scripts don't have effects.

It's on a MacPro 3.1 with 10.8.5.

Do someone knew how applescript / automator / Lingon X could detect a frozen application and doing an auto force quit?

Thanks a lot.


Model: MacPro 3.1
AppleScript: 2.5.1
Browser: Safari 602.4.8
Operating System: Mac OS X (10.8)

Last edited by FabriceAragno (2017-03-16 03:17:11 pm)



#2 2017-03-16 03:33:01 pm

From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 211

Re: How to auto force quit an application not responding (but active)

There is probably a terminal way to detect non-responsive applications and then you can force them to quit and relaunch, but since I'm not an expert in terminal, the first thing I'd try is something just in Applescript. I don't have Isadora, but it looks like it has an Applescript dictionary. I'd try just having a stay-open Applescript send Idadora some harmless Applescript query on a delayed repeat loop (name of window 1, or whatever Isadora supports) and if it fails to return that information to Applescript within a certain timeframe, then assume it's crashed and force quit it.

Force quit is just:


tell application "System Events" to set theID to (unix id of processes whose name is "Idadora")
do shell script "kill -9 " & theID

And then you can delay a few seconds and relaunch.

Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb



#3 2017-03-16 11:51:58 pm

Registered: 2017-03-16
Posts: 2

Re: How to auto force quit an application not responding (but active)

thanks for the reply t.spoon
I did try something like that, somehow like you purpose :

    set v to ""
            tell application "Isadora" to set v to version
        end try
        if v is "" then
            do shell script "killall Isadora"
        end if

but don't work,then I finally did this (from some web search and modified)  :

tell application "Activity Monitor" to run 
tell application "System Events" to tell process "Activity Monitor"
    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 "ne répond pas" -- 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

it seems to work.. waiting of the next "freeze"..

And when Isadora is not active a second AppleScript relaunch it.
So I hope when he unexpected quit or freeze he will restart using one or the two AppleScript...



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)