AppleScript - Open Mail to an specific inbox

I use MacOS Mail to handle multiple email accounts. I often want to open my work inbox and avoid seeing the other email.

The following AppleScript snippet opens my OCI inbox:

tell application "Mail"


    set ociInbox to mailbox "INBOX" of account "OCI"

    tell message viewer 1
        set selected mailboxes to ociInbox
    end tell

end tell

I learned about this thanks to the webinar Make Apple Mail dance webinar by David Sparks

Tags: #automation #applescript #mail #macos