title: Applescript to wait for AppleMail to download messages.
body: <p>Prior to 10.7.x this AppleScript used to work with AppleMail:</p>
  
  <pre><code>tell application "Mail"
     activate
     check for new mail
     repeat until (background activity count) = 0
         do shell script "sleep 1"
     end repeat
  end tell
  </code></pre>
  
  <p>However, since 10.7.x+ this does not seem to work anymore. It doesn't even go in to the repeat loop. My guess is that AppleMail has changed the way it downloads emails and doesn't use "background activity" anymore. </p>
  
  <p>Anyone know how to wait for all emails to download in AppleMail 5+ with AppleScript?</p>