Eudora: Accessing message subject, etc.

Joined
Jan 10, 2009
Messages
1
Reaction score
0
I'm trying to create an AppleScript that archives some IMAP mail, and running into a problem that is most likely a stupid case of me not knowing how to properly reference something.

The script accesses the Inbox of my main IMAP personality, and then accesses the current Archive mailbox (I couldn't find a way to get right to it by name, so I iterate through the mailboxes in the "Inbox" folder of the "Archive" folder of that IMAP personality). The goal is to copy or move messages meeting some criteria into the archive.

Accessing the Inbox and Archive seem OK. "Count of messages in ..." for both mailboxes returns numbers that look valid.

I then try to loop though the messages in the archive to build a table of what's already there. At this point, I run into errors.

The code:

Code:
[B][SIZE=4] set[/SIZE][/B][COLOR=#408000][SIZE=4] _aMsg[/SIZE][/COLOR][B][SIZE=4] to[/SIZE][/B][SIZE=4] ([/SIZE][B][SIZE=4]a reference to[/SIZE][/B][COLOR=#0000ff][I][SIZE=4] message[/SIZE][/I][/COLOR][COLOR=#408000][SIZE=4] _msgx[/SIZE][/COLOR][B][SIZE=4] of[/SIZE][/B][SIZE=4] ([/SIZE][COLOR=#408000][SIZE=4]_current_archive[/SIZE][/COLOR][SIZE=4]))[/SIZE][SIZE=4]
[/SIZE][B][SIZE=4] tell me to[/SIZE][/B][COLOR=#408000][SIZE=4] trace[/SIZE][/COLOR][SIZE=4]("Message " &[/SIZE][COLOR=#408000][SIZE=4] _msgx[/SIZE][/COLOR][SIZE=4] & ": (ID " & ([/SIZE][B][SIZE=4]get[/SIZE][/B][COLOR=#6c05d3][SIZE=4] id[/SIZE][/COLOR][B][SIZE=4] of[/SIZE][/B][COLOR=#0000ff][I][SIZE=4] message[/SIZE][/I][/COLOR][COLOR=#408000][SIZE=4] _msgx[/SIZE][/COLOR][B][SIZE=4] of[/SIZE][/B][COLOR=#408000][SIZE=4] _current_archive[/SIZE][/COLOR][SIZE=4]) & ") ")[/SIZE][SIZE=4]
[/SIZE][B][SIZE=4] tell me to[/SIZE][/B][COLOR=#408000][SIZE=4] trace[/SIZE][/COLOR][SIZE=4]("..." & ([/SIZE][B][SIZE=4]get[/SIZE][/B][COLOR=#6c05d3][SIZE=4] subject[/SIZE][/COLOR][B][SIZE=4] of[/SIZE][/B][COLOR=#408000][SIZE=4] _aMsg[/SIZE][/COLOR][SIZE=4]))[/SIZE]
returns an error when it tries to access the Subject; the Results window shows:

Code:
[B][SIZE=4]   error[/SIZE][/B][SIZE=4] "Can't get subject of \"I\"."[/SIZE][COLOR=#0000ff][SIZE=4] number[/SIZE][/COLOR][SIZE=4] -1728[/SIZE][COLOR=#0000ff][SIZE=4] from[/SIZE][/COLOR][SIZE=4] «[/SIZE][COLOR=#0000ff][I][SIZE=4]class[/SIZE][/I][/COLOR][SIZE=4] euSu»[/SIZE][B][SIZE=4] of[/SIZE][/B][SIZE=4] "I"[/SIZE]
It does get the ID, though, as the Results window shows:

Code:
[B][SIZE=4]   tell[/SIZE][/B][COLOR=#4a1e7f][SIZE=4] application "Eudora"[/SIZE][/COLOR][SIZE=4]
    [/SIZE][COLOR=#0016b0][B][SIZE=4]write[/SIZE][/B][/COLOR][SIZE=4] "Starting loop through 9009 messages in archive Inbox-2011
   "[/SIZE][COLOR=#0016b0][SIZE=4] to[/SIZE][/COLOR][SIZE=4] 47[/SIZE][SIZE=4]
    [/SIZE][COLOR=#4c4e4e][SIZE=4](*Message 1: (ID 73) *)[/SIZE][/COLOR][SIZE=4]
    [/SIZE][COLOR=#0016b0][B][SIZE=4]write[/SIZE][/B][/COLOR][SIZE=4] "Message 1: (ID 73)
   "[/SIZE][COLOR=#0016b0][SIZE=4] to[/SIZE][/COLOR][SIZE=4] 47[/SIZE][SIZE=4]
[/SIZE][COLOR=#ff0000][B][SIZE=4]   Result:[/SIZE][/B][/COLOR][SIZE=4]
[/SIZE][B][SIZE=4]   error[/SIZE][/B][SIZE=4] "Can't get subject of \"I\"."[/SIZE][COLOR=#0000ff][SIZE=4] number[/SIZE][/COLOR][SIZE=4] -1728[/SIZE][COLOR=#0000ff][SIZE=4] from[/SIZE][/COLOR][SIZE=4] «[/SIZE][COLOR=#0000ff][I][SIZE=4]class[/SIZE][/I][/COLOR][SIZE=4] euSu»[/SIZE][B][SIZE=4] of[/SIZE][/B][SIZE=4] "I"[/SIZE]
I have no idea what the "to 47" means, but it does seem to access message 1, and returns the ID as 73.

I've tried accessing the message subject more directly:

Code:
[B][SIZE=4] set[/SIZE][/B][COLOR=#408000][SIZE=4] the_subject[/SIZE][/COLOR][B][SIZE=4] to[/SIZE][/B][SIZE=4] ([/SIZE][COLOR=#6c05d3][SIZE=4]subject[/SIZE][/COLOR][B][SIZE=4] of[/SIZE][/B][SIZE=4] ([/SIZE][COLOR=#0000ff][I][SIZE=4]message[/SIZE][/I][/COLOR][COLOR=#408000][SIZE=4] _msgx[/SIZE][/COLOR][B][SIZE=4] of[/SIZE][/B][SIZE=4] ([/SIZE][COLOR=#408000][SIZE=4]_current_archive[/SIZE][/COLOR][SIZE=4])))[/SIZE]
but I get the same error.

When I try without the enclosing parens around "message _msgx of...", I get a conversion error; the code:

Code:
[B][SIZE=4]set[/SIZE][/B][COLOR=#408000][SIZE=4] the_subject[/SIZE][/COLOR][B][SIZE=4] to[/SIZE][/B][SIZE=4] ([/SIZE][COLOR=#6c05d3][SIZE=4]subject[/SIZE][/COLOR][B][SIZE=4] of[/SIZE][/B][COLOR=#0000ff][I][SIZE=4] message[/SIZE][/I][/COLOR][COLOR=#408000][SIZE=4] _msgx[/SIZE][/COLOR][B][SIZE=4] of[/SIZE][/B][SIZE=4] ([/SIZE][COLOR=#408000][SIZE=4]_current_archive[/SIZE][/COLOR][SIZE=4]))[/SIZE]
results in error:

Code:
[B][SIZE=4]   error[/SIZE][/B][SIZE=4] "Can't make «class euSu» of «class euMS» 1 of \"Inbox-2011\" into type Unicode text."[/SIZE][COLOR=#0000ff][SIZE=4] number[/SIZE][/COLOR][SIZE=4] -1700[/SIZE][COLOR=#0000ff][SIZE=4] from[/SIZE][/COLOR][SIZE=4] «[/SIZE][COLOR=#0000ff][I][SIZE=4]class[/SIZE][/I][/COLOR][SIZE=4] euSu»[/SIZE][B][SIZE=4] of[/SIZE][/B][SIZE=4] «[/SIZE][COLOR=#0000ff][I][SIZE=4]class[/SIZE][/I][/COLOR][SIZE=4] euMS» 1[/SIZE][B][SIZE=4] of[/SIZE][/B][SIZE=4] "Inbox-2011"[/SIZE][COLOR=#0000ff][SIZE=4] to[/SIZE][/COLOR][COLOR=#0000ff][I][SIZE=4] Unicode text[/SIZE][/I][/COLOR]
Any advice would be much appreciated.[/size]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top