Help with very simple script?

Yesterday I tried to use Automator to do a simple task which it failed at. Perhaps I was doing something wrong.
I wanted to set it up so that once per day, Mail.app takes all my Trash messages and moves them to another folder of my choosing. The idea is that I’m backing up my Trash (yes, that’s right). :slight_smile:
I was unable to do it with automator.
So I turned to applescript. But I was unable to make a script that actually does what I want. The online Applescript documentation is very hard to learn from and seems obsolete, using screenshot of the OS 9 script editor, and the Help menu of the Script Editor doesn’t even describe its main windows (e.g., what are those little colored letters in an application’s dictionary? I’m guessing they stand for “container,” “command”, “element”, and “property”, but I could not find any confirmation of this).

Anyhow, enough complaining. Here is the script I wrote as a baby step, including the stuff I commented out.

tell application “Mail”
set theMessage to every message of mailbox “TRASH” of account “richcook.net
set theMessage to mailbox “Trash” of account “richcook.net
end tell

There are definitely messages in my Trash mailbox. But here is what shows up in the Event Log:

tell application “Mail”
get every message of mailbox “TRASH” of account “richcook.net
{}
get mailbox “Trash” of account “richcook.net
mailbox “Trash” of account “richcook.net
end tell

Why does “every message” evaluate to {}? I was hoping to do this:

tell application “Mail”
set theMessages to every message of mailbox “TRASH” of account “richcook.net
move theMessages to mailbox “backups” of account “richcook.net
end tell

But I get errors because theMessages has a zero length.

Model: PowerMac G5
AppleScript: 1.10
Browser: Safari) OmniWeb/v563.42
Operating System: Mac OS X (10.4)

I think you’ll find the issue is that the mailbox isn’t actually called ‘TRASH’, but ‘Deleted Messages’.

For example, this works as expected:

tell application "Mail"
	get every message of mailbox "Deleted Messages" of account "camelot@mac.com"
end tell

Browser: Safari 412
Operating System: Mac OS X (10.3.7)

Well, I’ll be damned. Thanks!

Model: PowerMac G5
AppleScript: 1.10
Browser: Safari) OmniWeb/v563.42
Operating System: Mac OS X (10.4)