Scripting Mail's message with attachments.

Hi All,
the following two scripts don’t work in Yosemite

  1. FIRST SCRIPT
    tell application “Mail”
    set theMsgList to (messages in mailbox “MyFold” of account “MyIMAPaccount” whose deleted status = false
    try
    repeat with theMsg in theMsgList
    set numOfAttach to count of (mail attachments of the Msg)
    end repeat
    end try
    end tel

  2. SECOND SCRIPT
    tell application “Mail”
    set theMsgList to (messages in mailbox “MyFold” of account “MyIMAPaccount” whose deleted status = false
    try
    repeat with theMsg in theMsgList
    repeat with theAttachment in theMsg’s mail attachments
    get properties of theAttachment
    end repeat
    end try
    end tel

In ant case we get an error like this:
Mail got an error: AppleEvent handler failed." number -10000

Any clue ?

Many thanks…