Absolute beginner trying to manage mail inbox

Hello

I want to carry out some actions on a single inbox in a single account. The system has multiple email accounts active and I want to ensure the my script operates only on 1 inbox. Specifically, I want to save the attachments from that single account to a folder on the hard drive. I do not understand how to instruct finder to operate only on a single inbox.

I thought i could use this tell line to set/ identify the inbox i want the subsequent scripting to work on.

set theInbox to inbox of account “Baggage”

I get this error message: error “Mail got an error: Can’t get inbox of account "Baggage".” number -1728 from inbox of account “Baggage”

The apple list says this is what the message means; “The referenced object doesn’t exist. This is a run-time resolution error, such as when attempting to reference a third object when only two objects exist”.

The account named DOES exist so I must be using the wrong syntax. Could anyone help me with a clarification of how i should set this?

Thanks

Max

My understanding is that the correct syntax is :

tell application "Mail"
	set theInBox to mailbox "INBOX" of account "Baggage"
end tell

Yvan KOENIG running El Capitan 10.11.5 in French (VALLAURIS, France) samedi 16 juillet 2016 11:07:39

Hi,

inbox is a top level object, it doesn’t have an account element.

You could write

tell application "Mail"
	set theMessages to every message of inbox whose name of account of its mailbox is "MyAccount"
end tell

Stefan, Yvan, Thanks I’ll try these.

I was competent using the dBase III+ scripting language about 25 years ago…things have changed a bit!

This code behaves flawlessly :

tell application "Mail"
	set theInBox to mailbox "INBOX" of account "Baggage"
	set theMessages to messages of theInBox
end tell

Yvan KOENIG running El Capitan 10.11.5 in French (VALLAURIS, France) samedi 16 juillet 2016 12:36:05

Stefan, Yvan,

It’s all working fine now.

Thank you both for your guidance.

It’s not so intimidating once a few things work.

Max