Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Launch IM apps after network connection is established Apps
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.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[6,122 views]  

Launch IM apps after network connection is established | 7 comments | Create New Account
Click here to return to the 'Launch IM apps after network connection is established' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Launch IM apps after network connection is established
Authored by: karkle on Aug 12, '04 11:09:44AM

It looks like you are using curl to test if the network is alive. what I would recommend then is to use the -I option which only does a header fetch. It'll be faster since it doesn't have to download the whole page.

Checkout man curl for more info.

[ Reply to This | # ]

Launch IM apps after network connection is established
Authored by: club60.org on Aug 12, '04 11:20:21AM

Correct me if I am not right. If you are sitting behind a firewall and never use curl it will not be configured and will fail.



[ Reply to This | # ]
Launch IM apps after network connection is established
Authored by: Cap'n Hector on Aug 12, '04 02:14:06PM

Curl never needs to be configured.



[ Reply to This | # ]
Launch IM apps after network connection is established
Authored by: karkle on Aug 13, '04 12:40:49AM

Correct, normally curl doesn't need to be configured.

However if you are behind a proxy, and that is the only way you can connect to the internet, you will need to use the curl --proxy options. Curl does not pick this up from the Network configuration in the System Preferences.



[ Reply to This | # ]
Launch IM apps after network connection is established
Authored by: cheesy9999 on Aug 13, '04 05:28:40AM
I use a cool little utility called Peripheral Vision (not free...but cheap...$7 I believe) that monitors all sorts of connections (all USB, FireWire, Bluetooth, AirPort, Ethernet, File Volumes) and lets you run a script or application whenever a specific one is connected or disconnected.

I have it set up so when an AirPort connection is established at my college it automatically launches the VPN client and connects. I also have one for my iPod where it checks to see when iSync was last run and if it hasn't been run in the last 12 hours it syncs then quits iSync (it was getting annoying when it would sync every time it was connected). It also launches Pod2Go and PodQuest when an iPod is connected, then closes them when disconnected so the menus aren't taking up my screen. Here are the scripts:

iPod Connected:

tell application "Pod2GoMenu"
activate
end tell
tell application "PodQuest"
activate
end tell
tell application "iSync"
if (current date) - last sync > 5 * hours then
synchronize
repeat while syncing
delay 5
end repeat
end if
quit
end tell


iPod Disconnected:

tell application "System Events"
if (name of processes) contains "Pod2GoMenu" then
tell application "Pod2GoMenu"
quit
end tell
end if
if (name of processes) contains "PodQuest" then
tell application "PodQuest"
quit
end tell
end if
end tell


I'm no AppleScript pro so their may be a better way of doing these things...

[ Reply to This | # ]
Launch IM apps after network connection is established
Authored by: omnivector on Aug 13, '04 03:54:37PM

ew. why would you use the official yahoo and msn clients? just use one of the all-in-one programs like adium, proteus, or fire. they also automatically reconnect when you come online anyways.

---
- Tristan



[ Reply to This | # ]
Launch IM apps after network connection is established
Authored by: evands on Aug 16, '04 10:43:27PM
Adium X will handle this for you automatically starting with version 0.64 (forthcoming as of 8/16/04). :)

[ Reply to This | # ]