title: Check for active internet connection with Applescript/Automator
body: <p>I have an Automator workflow to ping a server, and download the latest copy of a schedule that I frequently use.  This schedule then is copied to my dropbox so I can view it on my phone.  Before the workflow downloads the newest schedule it deletes the old schedule from dropbox.</p>
  
  <p>This works well, except when I don't have an active internet connection.  When I don't have an active internet connection, the workflow will still open up dropbox, delete the old schedule, and try to download the newest one.  Because there is no connection, it doesn't download anything.  Then if my connection becomes active the empty dropbox will sync and the schedule will be deleted from my phone.</p>
  
  <p>I'm trying to add a few lines of applescript code to ping a server to see if i have an active connection.  If I don't, then wait about 5 seconds and ping again.  I want to have 5 ping attempts and at that point if i still do not have an active connection then I want to quit entirely.</p>
  
  <p>I'm very new to applescript, so I'm getting hung up on how to handle an error from a command, in this case, the ping.  If command "ping -o www.apple.com" fails, wait 5 seconds and retry the ping.  If 5 failed attempts then quit entirely.</p>