Help~ About applescript on Mail.app (OSX 10.3.9)

Discussion in 'Mac Programming' started by byf1987, Aug 1, 2006.

  1. macrumors newbie

    Joined:
    Aug 1, 2006
    #1
    Hi everyone, I am new to here...

    Can anyone help explaining this:

    I use the following code in my applescript for Mail.app, it's supposed to be run under certain rule:

    using terms from application "Mail"
    on perform mail action with messages theMessages
    tell application "Mail"
    display dialog "On perform mail action"
    my saveAttachments(theMessages)
    end tell
    end perform mail action with messages
    end using terms from

    and I have another "on run" block which is for debugging purpose:

    on run
    tell application "Mail"
    display dialog "On run"
    set theSelection to selection
    my saveAttachments(theSelection)
    end tell
    end run

    the "saveAtachments" works fine with "on run" (run from script editor) but does not work with "on perform mail action"...

    After debugging for some whole days, I found that the following code displays the raw source for the message when running with "on run", but displays something other than the raw source for "on perform mail action".

    repeat with eachMessage in messageList
    -- messageList is the parameter passed into "saveAttachment"
    display dialog source of eachMessage as text
    end repeat


    Can someone explain why, thanks a million in advance!

    Btw, I am new to applescript...my code is from here:
    http://lists.apple.com/archives/applescript-users/2003/Dec/msg01153.html

    Btw2, the raw source I want starts with "Return-path: ...". This is what is displayed in Mail.app's view of raw source.

    Btw3, the Mail.app on my PC is 1.3.11 (v622/624)

    Thank you all the same for your time if you are just viewing~
     
  2. thread starter macrumors newbie

    Joined:
    Aug 1, 2006
    #2
    Maybe I can address the problem this way:

    When an email is newly received in Mail.app, we can only get part of its header info by using "get source" or "get all headers" in the applescript.

    How if I want to get the full header?

    Thanks in advance again...
     
  3. thread starter macrumors newbie

    Joined:
    Aug 1, 2006
    #3
    Oh...no replies available before I figured it out myself...

    The solution...use POP account.

    This thread can be closed...thanks for those who paid attention...
     

Share This Page