2

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

  • 1
    does it work with single account? – Ruskes Dec 31 '14 at 8:56
  • Good question! If I change this line like this it works on the account "myaccount": set _msgs_to_move to (a reference to (every message of mailbox "INBOX" of the account "myaccount" whose flagged status is false and was replied to is true)) So I Guess I'll have to find a way to add a overarching loop through all the accounts? If you know how to do it already you'll save me sometime.... other ways I'll look thought is when I have time... – user1202609 Dec 31 '14 at 9:43
1

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
1

Do you get the same results using

tell application "Mail"
set _msgs_to_move to every message of inbox whose flagged status is false and was replied to is true
    log (count of _msgs_to_move)

end tell
  • Yes it seems to work and it is much simpler! Thanks! – user1202609 Dec 31 '14 at 11:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .