Jan 06 2008

Using Mail.app with multiple users — using AppleScript!

Published by Jonathan Wise under Code Snippets, Hacks

OK, this is pretty brilliant — and SO simple.

Here’s the setup: my wife and I share a Mac at home. For memory reasons, among others, I don’t want to use Fast User Switching, and because of my automated tasks, I don’t want the primary account to ever be logged out. So all many of our programs need to be set-up for two different users. Firefox has user profiles, that once configured, works perfect. Mail.app has no such thing. What I decided to then, was write an AppleScript that would switch Mail.app between users for us. This example is for two users, but it could be edited for more. Here’s how to use it:

  • Setup Mail accounts for each user
  • Modify the script to prompt for each user you have, and reference their account name
  • Replace your Mail.app dock icon with a link to your AppleScript (you can even give it the Mail.app icon)
  • Whenever you launch Mail, you’ll be asked which user you want to use
  • Even better than that, you can switch users just by clicking the Mail icon in your dock again. You don’t even have to close down Mail!

The result looks like this whenever you invoke the script, and launches/reconfigures Mail within two seconds. Set the delay to longer if Mail.app takes longer to start on your Mac.

The code is dead simple, and took me only moments to put together. Note that the delays and the order in which things are done is important so that it doesn’t hang waiting for Mail to start if its not already open.

-- Mail Account Chooser, by Jonathan Wise
-- Add user profiles to Mail.app
display dialog "Choose the Mail account to use" buttons {"Jon", "Nicole"} default button 1 with icon note
if the button returned of the result is "Jon" then
  tell application "Mail"
    activate
    delay 2
    set enabled of account "Nicole Home" to false
    set enabled of account "Jon Home" to true
  end tell
else
  tell application "Mail"
    activate
    delay 2
    set enabled of account "Jon Home" to false
    set enabled of account "Nicole Home" to true
  end tell
end if

11 responses so far

Nov 05 2007

Leopard doesn’t quite stack up

Published by Jonathan Wise under Articles

I’m a Mac fan boy, and I’m very tolerant of change. When the Mac using world screamed when they replaced OS 9 with OS X, killing a lot of the nice functionality in OS 9 in favor of a brand new OS, I drank the kool-aid and made the change as soon as I could.

And I’ve been a big fan of each major revision of X — and have run all of them right out of the gate, warts and all. But I’m not sold on Leopard.

The loudest touted features are either useless, or already existed in 3rd party apps for 10.4.
- Spaces is just VirtuDesktops — and a concept I never had any use for. I’d much rather have multiple monitors then multiple “virtual” screens.
- TimeMachine is just a back-up app — granted its well integrated and looks pretty. But the method I have in place now is much less intrusive (not to mention more fire-proof) and doesn’t require me to be tethered to a local external hard drive.

But nothing bugs me more than Stacks…
Stacks kills a feature I’ve used and loved in OS X since they killed the Apple menu’s hierarchical app-launching capabilities from OS 9.

It used to be, in OS X 10.2-10.4, that you could drop any folder onto the right side of the Dock and turn it into a menu by right clicking on it. In this way I could add my very organized Applications folder to my Dock and use it to find applications in a very simple manor (I’ll admit, its kind of like a Start Menu, but come on — its a good way to organize your apps).

In 10.5 that great feature was replaced with either a silly, and surprisingly static, curved list, or a box full of icons. Now that box can contain subfolders — but if you click on them, it opens a window. That’s a window you have to close after you find your application. Unacceptably stupid.

Know what else is stupid? Apparently there’s a massive data loss bug in the new Finder. For years — literally, we’ve been complaining about how awful the Finder is (even compared to its OS 9 grandparent) and this is the fix they offer us?

Damage to the Dock and a bad upgrade for the Finder aside (I do like the new sidebar, btw) Stacks are not what they were supposed to be. A “Stack” was designed as a replacement for (or addition to) the folder concept. It was an organizational item that existed in the Finder, had a single icon that could be dragged around like a file, but expanded when clicked to show a collection of items. There are plenty of UI prototype videos on the web showing what Stacks meant to us before Apple polluted the term.

I’m ditching Leopard for the time being. The only feature I really wanted was the improved Front Row… maybe there’s a way I can run it in 10.4. If not, I’ll just hold out hope that Apple gets their crap together with upcoming updates.

Update: Yay! It looks like they fixed stacks… a little bit!

4 responses so far