I have set up my firm’s case management system to email me three reports every Sunday evening. These reports arrive as attachments to email. For several months, I’ve been coming in on Monday morning and dragging those reports out of Mail and into Unclutter, which I keep in my Mac menu bar so I have easy access to certain files. I recently decided I would automate this process.
Looking around online, I found several AppleScripts purporting to accomplish this, but I wanted to see if I could accomplish this with Keyboard Maestro. I ended up doing it with Keyboard Maestro and Automator.
My Automator workflow, as depicted below, is pretty simple. It finds any email in my inbox that meets two conditions:
- The subject of the email must begin with words that are specific to the report emails; and
- The emails must have been sent in the last two days.
If those conditions are met, Automator gets the attachments from those messages and saves those attachments into the same Dropbox folder used by Unclutter to hold files. (I don’t know if I actually need the second step in the workflow).
Then it was simply a matter of setting up a Keyboard Maestro macro that would launch the Automator workflow every Monday before I arrived at the office.
The final step for me was to create a rule in Hazel to monitor Unclutter, and clean out old reports every week.
Caveat: I just set up this system yesterday, and forced it to run out of its normal schedule. It worked fine. I’ll see this Sunday evening whether it runs on the schedule I designated.
Here are links to the Automator workflow and Keyboard Maestro macro:
J. Gary Ellison says:
Both files (Automator workflow
Keyboard Maestro macro) have the same link. Only the Automator file can be downloaded.
December 11, 2018 — 10:59 pm
Evan Kline says:
Sorry about that Gary. I think I have the links fixed now. Thanks for the heads up.
December 13, 2018 — 4:19 pm
Timothy says:
Where do you have the Automator workflow reside once complete, and what triggers it to run spontaneoously when new eMails with attachments are received?
February 26, 2019 — 3:20 pm
Evan Kline says:
Timothy, the Automator workflows can reside anywhere. If you look at the second image, above, you’ll see that I don’t have it running spontaneously, but rather it runs at a set schedule via Keyboard Maestro. That image also shows where I have the workflow reside, but it doesn’t have to reside there.
March 7, 2019 — 1:20 pm
Beyo says:
Great hint. Hazel can be a bit redundant here, you could time trigger a script in KM but I understand if you use Hazel for other things it’s nice to have rules in one place.
Maybe you could achieve similar thing to add running applescript as part of Mail rules but in that case Mail app must be open, not sure if it can process ruless in background
January 23, 2020 — 5:43 pm