Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I would like to have a global shortcut key to send a new message using Thunderbird in Mac OS. How can I do this?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can assign a keyboard shortcut to a script like this:

tell application "Thunderbird"
    reopen
    activate
end tell
tell application "System Events" to tell process "Thunderbird"
    repeat 10 times
        try
            click menu item "Message" of menu 1 of menu item "New" of menu "File" of menu bar 1
            return
        on error
            delay 0.1
        end try
    end repeat
end tell

If Thunderbird was not open before the script was run, there is a short delay before the menu bar is populated.

Edit: this does not reopen the main window or switch desktops if the main window is already open on a different desktop:

launch application "Thunderbird"
tell application "System Events" to tell process "Thunderbird"
    repeat 10 times
        try
            click menu item "Message" of menu 1 of menu item "New" of menu "File" of menu bar 1
            exit repeat
        on error
            delay 0.1
        end try
    end repeat
    set frontmost to true
end tell

Edit 2: The second script also sometimes switches desktops, but I couldn't figure out how to prevent it.

share|improve this answer
    
Thanks, this mostly works, but still has the problem that the workspace changes and that the main Thunderbird window reopens. I just would like to have a new message window in the current workspace. –  anumi Sep 21 '13 at 7:53
    
@anumi I edited the answer to add a second script. –  Lri Sep 21 '13 at 8:05
    
The second solution does not reopen the main window, but still switches workspaces. But that's an improvement! –  anumi Sep 23 '13 at 20:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.