I would like a Applescript to pause while a specific process/script/app is not responding (temporarily or permanently) to system events, and to start-up again when the other process is back. In theory this could be done with a repeat loop provided there is a way to monitor the status of the process. Is there any code that can do this? via Terminal commands? via Applescript? Another possibility: can Applescript determine when the cursor has switched to the beach ball? Other ideas?

Quite simply in applescript terms, this is what I'd like:

repeat while "beach ball is spinning"
end repeat
  • I use Applescript to launch processes with specific parameters, then tidy up after that app is quit. In between times, they just sit there patiently, sometimes for days, until the launched app is quit [all the time claiming that they are not responding in Force-Quit or activity Monitor, but actually just doing their job of waiting for the next step.]
    – Tetsujin
    Aug 9, 2015 at 17:02
  • In my case, the Applescript must be told to pause until the other process is complete as the Applescript needs the result of that process to continue. I've seen the problem visually - the beach ball spend temporarily. So in effect, I'm trying to get an Applescript to pause when the beach ball is spinning over a process, and get Applescript to start again when the beach ball goes back to the cursor.
    – paamachat
    Aug 9, 2015 at 17:36
  • Not sure I can help then, in my experience it just waits forever for an answer.
    – Tetsujin
    Aug 9, 2015 at 17:37
  • How does your Applescript identify the process/script/app that is not responding to system events? Did it launch it? Can pgrep be used to get a pid from a string identifier? Aug 9, 2015 at 19:12
  • To answer your question, the script requires information from the non-responding app. If it doesn't get the information the script continues continues eventually leading to an error. I observed this in real time. Re pgrep. This is not my thing but I did search the manpage. Not sure how this solves the problem - what am I missing, i.e. what command line would I use to get an output indicating that the PID in question is not responding?
    – paamachat
    Aug 9, 2015 at 20:16

1 Answer 1


This may be convoluted but try using try and with timeout to probe for lack of response to an appleEvent. The target app will have to have at least the standard suite dictionary.

    with timeout of y seconds
        ## request something simple like set x to name for testing
    end timeout
on error
    ## whatever needs to happen during a stall
end try

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .