In my previouse post : Applescript – Quit or Launch Application if another is or is not running
- I noticed that even with the do shell script “kill -15 ” & appToKillID . line.
A app that was supposed to be killed looked like it had but its process was still running.
- Since I have stopped using the killall command.
I do not need to get the process ID’s. so that is removed. I now just check if there is a result from the System events process search. And set a true or false boolean to a variable. Which is checked later.
- In the previous post, I also show how to make the app run from a Launch Agent.
- It will change its name to either or Dsiabe_Dual_Apps.scpt depending what the current name of the file is. This then give me a way to see the status of the Launch Agent. Enabled or Disabled.
- This script will also load or unload the Launch Agent. T here is no checking if the Agent is loaded or not. For my purposes I do not think there is a need.
- set masterAppiDs to {“AppleScript Editor”, “Xcode”} #can be more than one app
- set slaveApps to {“Snippets”, “TextEdit”} #can be more than one app
The apps that a are told to close if none of the Master apps are running


If that all sounds like too much work.
Trust me it isn’t. Then you can just wrap the script in a good old fashioned idle handler.
Once saved as an Application with the Stay open after run handler checked.
The app will run every 10 seconds. You can adjust the return in the handler to what ever number of seconds you want.
To disable it just treat it like any old app. Quit it. 🙂
[iframe /blogR/OnIdledualApplQuitLaunchCodePostTwo.html 700 800]