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

Keep Yahoo IM Messsages accounts online Apps

If you use a Yahoo IM account in Messages and have a MacBook, you'll find your Yahoo account won't go back online whenever the Mac awakes from sleep mode. Apparently, AOL IM accounts are affected in this way too. Here's one simple solution to the problem that uses crontab to run a simple Applescript that periodically takes all the accounts online.

I write more about this on my blog, including a couple of caveats, but here are the basic steps:

1. Ensure Messages starts at login by right-clicking its Dock icon and Options > Open at Login. Remember that, in OS X Mountain Lion, apps not used for a while will appear to quit automatically, but don’t worry — these steps take that into account.

2. Open a Terminal window. You’ll find Terminal in the Utilities folder of the Applications list within Finder.

3. At the command-line prompt, type crontab -e

4. This will open your (probably) empty crontab file within the vi text editor. Press I to switch to insert mode, so you can type text. Then copy and paste the following, which is all one line:

*/15 * * * * osascript -e 'tell application "System Events" to tell application "Messages" to log in'

Note that if you copy and paste the line, the quotation/single quote marks might be “curly,” depending on which browser you use. This will stop the command working. You might need to delete the quotes, then type them again using your keyboard.

The command causes the AppleScript we specify to run every 15 minutes, which seems reasonable to me because I became a little wary that any more frequent running of the command might impact battery life of my MacBook. But you can change the 15 at the start of the line to any other value, such as 5 minutes.

5. Press Escape, then type :wq which will save the file and quit the editor.

That’s it. You can test it however you wish. Perhaps you might want to take all your accounts offline, then wait up to 15 minutes to find that you’re back online automatically in the background.


[kirkmc adds: I haven't tested this.]
    •    
  • Currently 2.29 / 5
  You rated: 1 / 5 (7 votes cast)
 
[5,026 views]  

Keep Yahoo IM Messsages accounts online | 6 comments | Create New Account
Click here to return to the 'Keep Yahoo IM Messsages accounts online' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Keep Yahoo IM Messsages accounts online
Authored by: paulgrav on Dec 19, '12 09:08:02AM

A better solution might be this AppleScript.

Open AppleScript Editor and paste the following into the script editor window.

using terms from application "Messages"
    on login finished for theService
        log in service "Yahoo"
    end login finished
end using terms from

You might need to change "Yahoo" in the line containing log in service "Yahoo" to what’s in the Description field of your Yahoo! account in Messages. You can view the value of the description field by opening Messages and pressing ⌘+, > Accounts > Click on Yahoo

Save the script somewhere.

Go back to Messages’ preferences and click on Alerts. Ensure that the “When I Log In” event field is selected. Tick ”Run an AppleScript script:” and choose the script that you just created.

This should solve the problem of Yahoo! not reconnecting.



[ Reply to This | # ]
Keep Yahoo IM Messsages accounts online
Authored by: keirthomas on Dec 19, '12 12:46:55PM

That's a really interesting approach, but perhaps better modified so -- like the AppleScript in the main article -- it attempts takes ALL accounts online?

In other words, use the following AppleScript:

tell application "System Events" to tell application "Messages" to log in

... save it out somewhere safe, then follow the instructions you mentioned to get it to run each time Messages attempts to log in.

The problem is that I don't think the script will be run unless Messages starts, and as mentioned it tends to terminate itself and not restart after waking from sleep. So you'd have to find a way of making Messages restart after sleep, and... We're back to square one!

You can turn off automatic termination via a defaults write command, but I don't like hacking away OS X's features just to make one particular thing work.



[ Reply to This | # ]
Keep Yahoo IM Messsages accounts online
Authored by: bedouin on Dec 19, '12 12:29:17PM

I thought user crontabs were depreciated in 10.6 in favor of launchd. You can add non-root crontabs but they are reset upon reboot.



[ Reply to This | # ]
Keep Yahoo IM Messsages accounts online
Authored by: keirthomas on Dec 19, '12 12:36:42PM

I'm running 10.8.2 and crontab entries stick around when I reboot.

Do you know where you learned about crontab entries being mandatorily deleted? Perhaps it was introduced with 10.6 but reinstated in 10.7/10.8?

Personally I can't see crontab entries causing any problems, and the technology is so well established in Unix culture that removing it would alienate a lot of people.



[ Reply to This | # ]
Keep Yahoo IM Messsages accounts online
Authored by: bedouin on Dec 19, '12 01:01:17PM

It was an experience I documented here:

http://hintsforums.macworld.com/showthread.php?t=101270



[ Reply to This | # ]
Keep Yahoo IM Messsages accounts online
Authored by: keirthomas on Dec 19, '12 02:15:28PM

This article...

http://alvinalexander.com/mac-os-x/mac-osx-startup-crontab-launchd-jobs

... explains it all.

Quote: "The cron utility is launched by launchd(8) when it sees the existence of /etc/crontab or files in /usr/lib/cron/tabs."

launchd has indeed superseded crontab, but crontab has essentially been turned into a launchd service! Did somebody say "legacy"?

As I say on my blog posting linked to in the article, what I outline is better done as a launchd service (and the web link above explains how), but it's just a lot simpler to setup and run it as a crontab event, and it's just as effective.



[ Reply to This | # ]