Ever had Messages disconnect in the background, only for you to find out that you’ve been offline for several hours? On a less-than-ideal Internet connection such as mine, this is a typical scenario. So much so that I came up with a script, which OS X Lion and Mountain Lion users can download below:
Messages Auto Reconnect.scpt (2KB, AppleScript)
- Download the script above, uncompress it, and save the resulting .SCPT file to your
~/Documentsfolder (or wherever convenient).
- Launch Messages and go to Preferences (Command + ,).
- Under Alerts, select the When I Log Out event, and check Run an AppleScript script:.
- In the dropdown beside it, select Choose Script…; browse to, select and open the .SCPT file you saved.
- Close the Preferences window, and you should be good to go.
Below is the raw AppleScript, inspired by this Google Forums post:
using terms from application "Messages" on logout finished for theService if (connection status of theService is disconnected and status is not offline) then delay 1 log in theService end if end logout finished end using terms from
For some reason, it fails to differentiate between disconnected and offline, so you’ll need to quit Messages if you want to go offline. Other than that, it works perfectly for my needs.
This script is provided as-is. Suggestions for fixes and improvements are welcome, but beyond that, I am unable to provide any support.