Applescript to open a different account's INBOX in

10 Jun 2008

Posted by acrollet

A while ago, I threatened to post this script, and then it slipped my mind, mostly because I switched to Gyazmail. At any rate, one of the most frustrating things about to me was having to get out the mouse to switch between the inboxes of my various email accounts, especially once I got Mail Act-On working so nicely. The applescript was harder to figure out than it perhaps should have been, so here it is in the hopes that it will help someone.

  1. tell application "Mail"
  2.         set the selected mailboxes of the front message viewer to {mailbox "INBOX" of account "Gmail"}
  3.         delay 0.1
  4.         set no_selected to get count selection
  5. end tell
  7. if (no_selected is equal to 0) then
  8.         tell application "System Events"
  9.                 set selected of row -1 of table 1 of scroll area 1 of splitter group 2 of window 1 of application process "Mail" to true
  10.         end tell
  11. end if

Paste the script into Script, change Gmail to whatever you have your account named, and save it to ~/Library/Scripts. You'll need to use something like Quicksilver or FastScripts to set up a keyboard shortcut, and then away you go.

Add new comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.