mdelatorre icon

Applescript to auto save mail attachment in Apple Mail

mdelatorre | PRO | 09/05/20 05:00:33 AM UTC | 0 ⭐ | 22208 👁️ | Never ⏰ | []
AppleScript |

680 B

|

None

|

0 👍

/

0 👎

-- Tested on macOS 10.13.6
 
use AppleScript version "2.4"
use scripting additions
 
using terms from application "Mail"
    on perform mail action with messages messageList in mailboxes mbox for rule aRule
        
        --  Save on DesktopPath     
        set desktopPath to (path to desktop) as string
        
        tell application "Mail"
            set selectedMessages to the selection
            repeat with aMessage in selectedMessages
                repeat with anAttachment in mail attachments of aMessage
                    set attachmentName to name of anAttachment
                    save anAttachment in file (desktopPath & attachmentName)
                    
                end repeat
            end repeat
        end tell
        
    end perform mail action with messages
end using terms from

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎