Created
February 14, 2015 12:03
-
-
Save henryroe/085cead4751d19c2a5ad to your computer and use it in GitHub Desktop.
Revisions
-
henryroe created this gist
Feb 14, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ set outputPath to choose folder tell application "Mail" set curMessage to selection set listAttachments to mail attachment of item 1 of curMessage set curMessageDate to date received of item 1 of curMessage set dateStr to (rich text -4 thru -1 of ("0000" & (year of curMessageDate))) & "-" & ¬ (rich text -2 thru -1 of ("00" & ((month of curMessageDate) as integer))) & "-" & ¬ (rich text -2 thru -1 of ("00" & (day of curMessageDate))) repeat with a from 1 to length of listAttachments set curAttachment to item a of listAttachments set curSavePath to (outputPath as string) & (dateStr & "_" & (name of curAttachment)) save curAttachment in curSavePath end repeat end tell