Advertisement
applehelpwriter

move mail attachments

May 25th, 2014
2,804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*
  2. This is part of a workflow for moving and printing email attachments from a given sender
  3. For the rest of the solution see the post at:
  4.  
  5. http://wp.me/p1ItrK-Wf
  6.  
  7. Copyright 2014 Phil Stokes Applehelpwriter.com
  8. *)
  9.  
  10. using terms from application "Mail"
  11.     on perform mail action with messages theMessages
  12.        
  13.         -- see the example at the end of my blog post (link in the header) for how to format this line:
  14.         set attachmentsFolder to "Volumes:<name of volume>:<name of folder>:" as rich text
  15.        
  16.        
  17.         tell application "Mail"
  18.             set selectedMessages to theMessages
  19.             try
  20.                 repeat with theMessage in selectedMessages
  21.                    
  22.                     repeat with theAttachment in theMessage's mail attachments
  23.                         set originalName to name of theAttachment
  24.                         set savePath to attachmentsFolder & originalName
  25.                        
  26.                         save theAttachment in file savePath
  27.                     end repeat
  28.                 end repeat
  29.             end try
  30.            
  31.         end tell
  32.        
  33.     end perform mail action with messages
  34. end using terms from
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement