Last Updated on
I don’t suppose it’s possible to share a macro for using KM to create and send an email based on a file being present in a particular folder? BTW loving the site! —Mark
Keyboard Maestro has over a dozen triggers that in turn trigger other actions. So for example, you can assign a keyboard shortcut trigger or a time trigger to trigger one or more actions.
For this particular action, we need a Folder Trigger, which is triggered when a particular file is added to the folder.
So in a new macro, you select the Folder Trigger from the drop-down under “Trigger by any of the following.”
The second part of the action is to send a preset email when a folder is added to the specified folder. Keyboard Maestro contains an action for just that purpose.
In the macro editor, you do a search for “Send a Mail” or click on the Notifications folder inside of Actions to locate it.
In the email action, fill in the appropriate information, and select to have to have the email sent immediately after the folder trigger occurs, or to open the email in Mail.
If you plan to have the email sent immediately, then you should test the action to make sure everything is set up properly.
Using Hazel, you set up a folder action that fires when a particular file is added to a folder. This folder action in turn can fire the Keyboard Maestro action we created. The following instructions assume that you have a basic understanding of how Hazel works.
In order to do this, you will first need the AppleScript script for the KM action. Grab the scrip by clicking the “Or by script” under the Trigger part of the macro. Select “Apple Script” and copy that.
Now open Hazel, and add the folder you want to trigger the action.
Next, assign the Hazel trigger a name, set the rules for the trigger, and then select Run AppleScript from the drop-down under “Do the following to the matched file or folder.” Where it says “embedded script,” click on the Edit script button and paste the KM script in there.
Hazel runs that script when the specified file is added to the assigned folder. This is called mapping one application to another.
Your Automation Question
You are encouraged to send your own automation question to me, and if I can answer it, I will may post your question and my response as a blog post for which other readers may find useful.
I also accept guest blog posts about Mac automation. Use the contact form to send your question, or send you idea for an article.