AppleScript to close running processes
Maybe a late response but I'm new to codereview but not to AppleScript. The problem with AppleScript and scripts that stays open is that they leak memory. Why? I just blame it on AppleEvents. It's a nice feature, it really is, but it does eats memory somehow. So the longer the script will run the more memory it will eat. Eventually, maybe after 6 months, your fans will start blowing for now reason and the mac becomes significant slower. But maybe it does that after a day, a week or a year. It's hard to tell in AppleScript where and how much a script leaks. 

To solve this there are several ways to do this. You can do it with cron (is since Tiger built inside launchd) with a shell script or create a new process of itself and quit. Either way they all remove the repeat loop out of the AppleScript and let that part be handled by other, much better, software. Note: using an idle handler inside AppleScript will eat memory too which should be the nicest solution instead of using a repeat and a delay.

My advise, is that the script won't be eating to much memory so I would spawn a new process of itself just over some time. You're waiting 10 seconds so 360 loops would be enough. You spawn a new process around every hour.

change the repeat to repeat 360 times and add the following code to the end of your AppleScript file. 


  do shell script "osascript " &amp; quoted form of posix path of
  (path to me) &amp; " &amp;>/dev/null &amp;"


Note: User interaction (display or choose commands) is not allowed when a script is launched by osascript in Mountain lion or earlier. For any user interaction change the target to SystemUIServer or Finder for instance.