Scripting Mail in Tiger?

I did some searching, but didn’t find anything that I could use…

I’m simply wanting to create scripts for Mail that would allow me to switch to specific custom mailboxes that I’ve created, using keyboard shortcuts.

This is what I’ve tried so far, but it doesn’t actually switch to the mailbox that’s named in the script! I don’t get any sort of error either:

set mailbox to "3) Family Mail"
tell application "Mail" to activate
open mailbox

Any ideas? Is this even possible?


Model: PowerMac G5/2.0GHz dually
AppleScript: 1.10.6
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)

I’m not sure what you are doing, but I know “mailbox” is not a variable used by mail. its an object, try changing “Mailbox” to “mailbox1”


Model: PMG5 DP 2.5 GHZ
AppleScript: 1.10.6
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)

I’m simply trying to add some functionality to Mail. I want to be able to go to my custom mailboxes through keyboard shortcuts, and I thought AS would (should?) be one way to accomplish that.

As for your suggestion, what would ‘mailbox1’ do for me??

Thanks anyway,

Hi John,

Do you mean something like:

tell application "Mail"
	set selected mailboxes of message viewers to {mailbox "Sent"}
end tell

You can use the full path to the mailbox as in the list returned from:

tell application "Mail"
	set myList to mailboxes
	repeat with myAccount in accounts
		set myList2 to (mailboxes of myAccount)
		set myList to myList & (contents of myList2)
	end repeat
	return myList
end tell

Best wishes

John M

John M, you’re my hero! :smiley:

I don’t know what took so long for someone to see my post here, but it doesn’t matter, because you figured it out for me. For that, I’ll be forever grateful!!

Thanks so much,