I discovered IFTTT a few months back, and recently, I was looking into more advanced IFTTT recipes when I found an interesting article. After reading the article (listed at the bottom) by Harry Guinness about how he used Keyboard Maestro to control his Mac from his phone, I realized I could adapt some of his work to be controlled by Amazon Alexa instead. I messed around with this and with voice commands I am now able to do various tasks including: restarting and shutting down my Mac, opening applications, and opening webpages, among other actions. Below I will provide step-by-step instructions on how to do this with images. The example I use shuts down my Mac with my voice.
Step 1: Setting up the First IFTTT AppletMake a new applet starting with Amazon Alexa. Choose the "Say a Specific Phrase" option. I use the phrase "Shut down mack." I use the spelling "mack" instead of Mac because upon testing I found better results with this spelling.
Click create trigger. For the next action choose G-Mail, and after clicking G-Mail, click send e-mail. Make sure to send your e-mail to the e-mail address associated with your IFTTT account. On a side note, if you plan to use these types of applets a lot they will send a lot of e-mails, so be aware of this. Because of this, I do not use my main e-mail in my IFTTT account.
In this example, I use the subject "Shutdown" which is necessary for a later step. Enter your e-mail address and finish the applet.
Step 2: Making the Second AppletMake a new applet now. Select G-Mail and choose the "New e-mail in inbox from search" trigger.
For the action select Dropbox, and then choose create a text file. Scroll to the bottom of the next page. Make sure you have the correct folder path (the default folder path is IFTTT/Gmail). If you are planning on having multiple voice controlled actions then I suggest you make separate subfolders in your Dropbox inside the IFTTT folder describing each additional action. This is why I named my folder for this action "Shutdown." Otherwise, if you stick with the default folder path (IFTTT/Gmail) you will only be able to have one voice controlled action.
This is pretty simple. Download Dropbox offline, and make sure you allow it to download all new files in the cloud to your Mac for offline usage. This is vital and the overall process can not work without this. Download Keyboard Maestro from its website, and install it.
Step 4: Setting up the Keyboard Maestro Triggers and ActionsOpen Keyboard Maestro and Create a new Macro Group. I named mine "Alexa Control."
Then click File, New Macro, and you should see a screen like the one below.
After this, click on "New Trigger" and select Folder Trigger. The default folder path is ~/Downloads. You need to change this to the folder path you specified in the IFTTT Dropbox trigger. Use mine as a model. If you find this hard, you can click the purple folder button, which is right of the text box (it is out of view in the screenshot below), and then you can browse to the desired Dropbox folder.
The next thing you need to do is choose an action. Click on the "New Action" Button. Since I want my computer to shut down, I clicked on the "System Control" folder and then proceeded to select the "Shut Down Computer" option. Drag this action into the area into the blank space that says "No Action." Also, make sure to click on the "Ignore Partial Files" option and change it to "Trigger All Changes Immediately." Your Screen should look like mine does in the second screenshot below.
From here you should be done. Therefore you need to test your program. You can make a wide variety of other voice controlled actions through this same process. Unfortunately, you have to program each individual action you want to control with your voice.
Comments