Eudora: Accessing message subject, etc.

Discussion in 'AppleScript' started by emailboy, Feb 23, 2012.

  1. emailboy

    emailboy New Member

    Joined:
    Jan 10, 2009
    Messages:
    1
    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]
     
    emailboy, Feb 23, 2012
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Norm
    Replies:
    2
    Views:
    256
  2. Bible John
    Replies:
    1
    Views:
    270
    Kathy Morgan
    Sep 14, 2005
  3. booksmartbilly@gmail.com

    Require a "Subject" before sending a message in Mail

    booksmartbilly@gmail.com, Sep 13, 2006, in forum: Apps
    Replies:
    1
    Views:
    215
    Leonard Blaisdell
    Sep 13, 2006
  4. AES
    Replies:
    5
    Views:
    227
    Tom Stiller
    Jun 5, 2011
  5. Michelle Steiner

    Changing the subject of an incoming mail.app message

    Michelle Steiner, Dec 2, 2007, in forum: Communication
    Replies:
    1
    Views:
    222
    Madwen
    Dec 2, 2007
  6. Michelle Steiner
    Replies:
    1
    Views:
    217
    Madwen
    Dec 2, 2007
  7. Michelle Steiner

    Changing the subject of an incoming mail.app message

    Michelle Steiner, Dec 2, 2007, in forum: AppleScript
    Replies:
    4
    Views:
    252
    Hylton Boothroyd
    Dec 12, 2007
  8. Howard
    Replies:
    5
    Views:
    336
Loading...