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 characters
tell application "Mail" | |
set selectedMessages to selection | |
set destinationFolder to choose folder with prompt "Pick a Destination" | |
repeat with currentMessage in selectedMessages | |
repeat 1 times | |
set msgSenderFull to extract name from sender of currentMessage | |
set msgSender to word 2 of msgSenderFull | |
set msgAttachments to mail attachments of currentMessage |
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 characters
set thisYear to do shell script "date '+%Y'" | |
set thisMonth to do shell script "date '+%m'" | |
set lastMonth to do shell script "date -v -1m '+%m'" | |
set thisDay to do shell script "date '+%d'" | |
(If I'm processing reports at the end of the month, use current month for file name. If not, use last month. *) | |
if thisDay > 20 then | |
set myDate to thisYear & "-" & thisMonth | |
else |
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 characters
tell application "Finder" | |
set FolderPath to (choose folder) -- sets file path to folder you select | |
set ParentFolder to container of FolderPath -- sets the parent folder of the folder you select | |
set Foldername to name of folder FolderPath -- sets the folder name as text | |
display dialog FolderPath as text | |
display dialog ParentFolder as text | |
display dialog Foldername as text | |
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 characters
# Gets dates I'll use to rename files | |
set thisYear to do shell script "date '+%Y'" | |
set thisMonth to do shell script "date '+%m'" | |
set lastMonth to do shell script "date -v -1m '+%m'" | |
set thisDay to do shell script "date '+%d'" | |
(If I'm processing reports at the end of the month, use current month for file name. If not, use last month. *) | |
if thisDay > 20 then |