Hi Phil,
Specifically, we have an application that pretty much runs constantly. Except as of late (complicated reason that I need to fully diagnose), the app is going unresponsive when it's just sitting there. We use Applescript to trigger some actions with this app, but when it is unresponsive, the applescripts become very unhappy.
Since the Applescripts provide automation so no one needs to babysit the computer, this little hanging problem is throwing a bit of cog in my automation plans. I am a total noob, so the applescripts don't have any proper error handling, they just boss the application around a little bit. I thought it might be wise to step up to the plate and actually employ some error handling fun.
Specifically, I want to test to see if the specific application is running. If it is unresponsive, I would like a routine to quit the application by force if necessary, then restart the application before running the other scripts. One additional caveat is that whenever the application crashes or is force-quit, upon restart, it always offers the option to send a report to the developer….. So I'm wondering if I need or can, address that issue as well, automatically.
Of course I DO want to know whenever the app requires a force-quit, but I'd like it to be handled without me being there at the precise moment.
Easy peasy, huh? :-)
Thanks, Dee Dee
On Jun 26, 2013, at 4:13 AM, 2551 wrote: Hi Dee Dee
Interesting problem, but can you clarify? Are you looking for a way to find any applications that are not responding and to force-quit them, or are you looking for a way to query a *particular* application (whose name you know in advance) to see whether it’s hung and quit it if so?
These are two very different problems, both of them difficult to my mind (thought the second is probably easier), and which I think AS could only handle by proxy through the Shell.
If you have Xcode and CommandLineTools installed you might be able to use tools like iProfiler and Instruments. You could also possibly query a sysdiagnose report. The command spindump run from Terminal will also give you a report on processes (see the man pages for more info on both of those); in neither case am I sure what you’d want to grep for, off the top of my head.
Part of the problem with developing an answer to this is you'd need to be able to create a non-responding process at will to see what kind of behaviours could be detected and to test. That in itself is something I’m not sure how to do (though I suspect there must be an easy way) - if anyone has any ideas I’m willing to give it a go. Like I said, interesting problem.
On 26 Jun 2013, at 03:24, Dee Dee Sommers < email@hidden> wrote: Hi,
Is it possible, using Applescript, to determine if an application has stopped responding and if so, to force-quit that app?
OS 10.8.4
Thank you! Dee Dee
|