Quit application with no window open

Is there a macro to quit automatically applications that :

  • have no window open ;
  • have been open for at least 10 minutes with no activity ?

There are just running in the background with no purpose. It's what happens when you close all the windows of an application but it's still running until you manually quit it.

So you want to close an application if that application has had no sub windows open for ten minutes. Many applications don't use sub-windows. Like most of Apple's applications. Eg, Pages, Numbers, Keynote. May I ask what applications you are thinking of? How does the macro know whether the program potentially has sub windows or not? For example, Pages doesn't have sub windows, so do you want pages to be shut down after 10 minutes? Or can you provide a list of apps that you want monitored. I think that would simplify the problem a lot.

The main problem I see is your phrase "no activity". Do you mean no activity with mouse and keyboard, or do you mean the user not clicking inside the application's menu at all for ten minutes. Hopefully you mean the former. Determining whether a user has sent a key or a mouse click to an application seems very difficult. KM can't even intercept mouse clicks.

If you mean no activity on the keyboard for ten minutes, there's a KM trigger called Idle which can address that. That's the easy half of this problem.