Every six hours, labels the inbox mail from the senders and subjects you nominate and archives it out of the way.
Uses
Gmail
Clear the mail you never read out of your inbox
clutterSenders to blank.Set clutterSenders to blank.clutterSubjects to blank.Set clutterSubjects to blank.labelName to blank.Set labelName to blank.maxToArchive to 25.Set maxToArchive to 25.inboxScanLimit to 50.Set inboxScanLimit to 50.punctuationMarks to [!, ?, :, ;, ,, ., (, ), [, ], , ', |"].Set punctuationMarks to [!, ?, :, ;, ,, ., (, ), [, ], , ', |"].senderRules to an empty list.Set senderRules to an empty list.rawSender in clutterSenders split by ,:For each rawSender in clutterSenders split by ,:rawSender lowercase and save it as senderRule.Make rawSender lowercase and save it as senderRule.senderRule isn't emptyIf senderRule isn't emptyYes
senderRule to the end of senderRules and save it as senderRules.Add senderRule to the end of senderRules and save it as senderRules.No
No steps
subjectRules to an empty list.Set subjectRules to an empty list.rawSubject in clutterSubjects split by ,:For each rawSubject in clutterSubjects split by ,:rawSubject lowercase and save it as subjectRule.Make rawSubject lowercase and save it as subjectRule.subjectRule isn't emptyIf subjectRule isn't emptyYes
subjectRule to the end of subjectRules and save it as subjectRules.Add subjectRule to the end of subjectRules and save it as subjectRules.No
No steps
searchTerms to an empty list.Set searchTerms to an empty list.searchSender in senderRules:For each searchSender in senderRules:searchSender to the end of searchTerms and save it as searchTerms.Add from:searchSender to the end of searchTerms and save it as searchTerms.searchPhrase in subjectRules:For each searchPhrase in subjectRules:@searchPhrase to the end of searchTerms and save it as searchTerms.Add subject:@searchPhrase to the end of searchTerms and save it as searchTerms.searchTerms is emptyIf searchTerms is emptyYes
No
No steps
inboxSearch to {searchTerms joined by a space}.Set inboxSearch to {searchTerms joined by a space}.inboxSearch. Save it as inbox.List emails matching inboxSearch. Save it as inbox.candidates to inbox.emails.Set candidates to inbox.emails.labelName and save it as label.Trim labelName and save it as label.archivedCount to 0.Set archivedCount to 0.message in candidates:For each message in candidates:archivedCount is greater than or equal to maxToArchiveIf archivedCount is greater than or equal to maxToArchiveYes
No
No steps
clutterErrorIf a step below fails, save the error as clutterErrorTry
message.id and save it as messageId.Trim message.id and save it as messageId.message.from and save it as fromHeader.Trim message.from and save it as fromHeader.senderAddress to fromHeader.Set senderAddress to fromHeader.fromHeader contains <If fromHeader contains <Yes
fromHeader split by < split by > and save it as senderAddress.Get the first item of the last item of fromHeader split by < split by > and save it as senderAddress.No
No steps
senderAddress lowercase and save it as senderAddress.Make senderAddress lowercase and save it as senderAddress.message.subject lowercase and save it as subjectText.Make message.subject lowercase and save it as subjectText.mark in punctuationMarks:For each mark in punctuationMarks:mark with in subjectText and save it as subjectText. Replace mark with in subjectText and save it as subjectText.paddedSubject to subjectText .Set paddedSubject to subjectText .senderRules includes senderAddress and save it as matched.Check whether senderRules includes senderAddress and save it as matched.phrase in subjectRules:For each phrase in subjectRules:paddedSubject contains phrase (ignoring case) If paddedSubject contains phrase (ignoring case)Yes
matched to true.Change matched to true.No
No steps
matched is yesIf matched is yesYes
label to email messageId.Add label label to email messageId.messageId.Archive email messageId.archivedCount.Add 1 to archivedCount.No
No steps
On error
clutterError as text.Show in the output: Left one message in the inbox because it could not be read: clutterError as text.archivedCount as text message(s). Nothing was deleted - search for the label to review what was cleared or move any of it back.Show in the output: Labelled '@label' and archived archivedCount as text message(s). Nothing was deleted - search for the label to review what was cleared or move any of it back.