Launch IM apps after network connection is established

Aug 12, '04 09:48:00AM

Contributed by: gorkonapple

In having frustrations of having to go back and hit the reconnec on Yahoo and MSN Messenger after booting up my Mac at home (iChat works fine) due to the slight delay in logging on to my Airport network, I decided a script was in order. By the time the startup items are complete and you're ready to use it, all of the IM sessions are logged in, instead of having to click on the reconnect buttons. I also added WeatherPop to this so it won't try to run and grab your forecast when the network isn't there yet. This uses an earlier hint that checks for the network.

on idle
  try
    do shell script "curl www.apple.com"
    tell application "MSN Messenger"
      activate
      close the front window
    end tell
    tell application "Yahoo! Messenger"
      activate
      delay 2
      close window "Yahoo! Messenger"
    end tell
    tell application "iChat"
      activate
      close the front window
    end tell
    tell application "WeatherPop"
      activate
    end tell
    quit
  on error
    -- say "Network not available"
  end try
  return 2
end idle
Use the 'Stay Open' option when saving this AppleScript, and it will check every two seconds for network availability. Then it launchs the IM's and WeatherPop. Modify the script if you're on a proxy.

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040810234445365