Goal: In addition to recurring tasks that I need to do on a regular, ongoing basis, there are other sets of tasks that I need to do on a recurring but non-regular basis. For example, whenever a family begins a new adoption and sends us the information on the child(ren) being adopted, there’s a series of tasks that I need to do in order to get things rolling for them. This can happen at any time, and in order to make sure that I don’t miss anything for any child’s adoption, I’ve created an AppleScript that adds a new project to Things whenever I get that email. That’s an AppleScript that I want my Mac’s email client to trigger automatically.
Problem: MailMate doesn’t have an easy, built-in way to trigger a custom AppleScript. This is one thing—quite possibly the only thing—that Apple’s Mail.app does more easily than MailMate. But don’t despair. There is a way to do this with just a few minutes and some careful attention to detail.
Solution: For each AppleScript that you want to run, you have to create a custom bundle in MailMate, which isn’t nearly as intimidating as it might sound, even for a non-developer like me. In fact, I still don’t know how to define a bundle or properly describe it to someone else, but that hasn’t stopped me from successfully creating about a dozen of them. Let’s get to it.
Set Up Custom AppleScripts for MailMate Rules
- Go to
~/Library/Application Support/MailMate/Managed/Bundlesand locate the
Things.mmbundlefile. I used the Things bundle as a template because I wanted to set up rules for my inbox that would create specific tasks and projects in Things based on certain criteria. (More on that in a future blog post.) But, since these tasks are created by AppleScript, you can use this bundle as a way to execute any other AppleScripts you might want to have MailMate execute automatically.
- Duplicate the file in the Finder, rename it, and open it with a text editor. I used TextWrangler, and it worked great for this. Whatever you do, though, do not open the original version of the
Things.mmbundlefile, because that, at the very least, will serve as your template for other custom AppleScripts in the future.
- Open the Terminal app. You’re going to need to generate three separate UUIDs for this by running the simple command
uuidgen. Go ahead and run it three times, and then leave the Terminal window open so that you can copy those UUIDs and paste them into the bundle at the appropriate spots.
- In the
Add With Summarysection (see sidebar), change the UUID near the bottom of the code with the first UUID generated in the Terminal.
- Do the same thing in the
Add.mmCommandsection, using the second UUID generated in the Terminal.
- Make the same change in the
info.plistsection, using the third UUID generated in the Terminal.
- In the
info.plistsection, also be sure to change the name of the bundle. This is the name that will show up in the
Commandmenu in MailMate. If you don’t change it from
Things.bundle, MailMate will only list one
Thingsbundle but won’t know which one to trigger. So be sure to follow this step.
- Save the new text bundle.
- Relaunch MailMate.
- Set up your mail rule for your inbox, and enjoy the rush when your AppleScript is triggered by an incoming message and your Mac does precisely what you wanted it to do.