Я новичок в AppleScript и пытаюсь написать скрипт, который удалит все вложения во всех сообщениях в указанном почтовом ящике (Mail.app).
Вот что я пытаюсь:
tell application "Mail"
tell mailbox "Sent" of account id "<XXX>"
set ListMessage to get every message
repeat with aMessage in ListMessage
set aList to get every mail attachment of aMessage
repeat with aFile in aList
if (downloaded of aFile) then
delete aFile -- this gives an error
end if
end repeat -- next file
end repeat -- next message
end tell
end tell
Запуск этого приводит к ошибке:
Error: the Apple Event handler failed (errAEEventFailed:-10000)
Что я делаю не так?
Спасибо!