Skip to content

Instantly share code, notes, and snippets.

View shibaku's full-sized avatar

John Seebach shibaku

  • Northern Virginia
View GitHub Profile
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
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
@shibaku
shibaku / Folder Path reference.scpt
Last active September 22, 2022 00:55
Applescript to return name, path, and path to parent folder of a given folder in Finder.
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
# 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