MacOS – Mail applescript stopped working on Yosemite

macosmail.app

This script stopped working in Yosemite. Any suggestion would be much appreciated.

tell application "Mail"
try


    set _msgs_to_move to (a reference to (every message of mailbox "INBOX" of every account whose flagged status is false and was replied to is true))
    set _msg_list to contents of _msgs_to_move
    if (_msg_list's length > 0) then
        move _msgs_to_move to mailbox "messaggi letti"
    end if
    -- End update for 10.7.0
end try
end tell

I get the following error:

get every message of mailbox "INBOX" of every account whose flagged
status = false and was replied to = true
–> error number -1728 from
mailbox "INBOX" of every account

Thank you!

Michele

Best Answer

Thanks to Buscar comment I solved it:

tell application "Mail"
set accountlist to the name of every account
try
    repeat with n from 1 to (the number of items in accountlist)
        set _msgs_to_move to (a reference to (every message of mailbox "INBOX" of the account (item n of accountlist) whose flagged status is false and was replied to is true))
        set _msg_list to contents of _msgs_to_move
        if (_msg_list's length > 0) then
            move _msgs_to_move to mailbox "messaggi letti"
        end if
    end repeat
end try
end tell