My Robots Are Talking To You

So, I had a crazy idea of what to do with the WeMo Light Switch “Long Press” feature a little while ago. The idea was when I was leaving for work that I could “long press” the switch and have it do something for me, namely, send a text message. I thought of several ways to do this. IFTTT can do this very easily if you have an Android phone but I don’t and I won’t so that was out of the question. You could also activate the SMS channel with your intended recipient’s phone number but that will restrict your use of the the IFTTT SMS channel which can be useful for other things. My next idea was to use the iPhone app Launch Center Pro ad IFTTT. Launch Center Pro is an Automation app for the iPhone and iPad. It uses url schemes to automate certain apps to do certain things at the press of one button in Launch Center Pro. I fiddled around with this for a while and I got it to work, sort of. I created the custom URL in Launch Center Pro that looked like this:

“launch://messging?to=xxx-xxx-xxxx&body={{Leaving for work}}

Then I set up an IFTTT recipe that was something along the lines of “if Long Press, then run Launch Center Pro custom URL”. What this actually does though is send you a notification when this URL is ready to run. So you would Long Press and, instead of the URL running and sending the text by itself, it sends you a notification that the Launch Center Pro has the URL ready to run. This will save you a little time because all you have to do is tap on the notification to launch Launch Center Pro and then it will automatically take you over to the messages app and have the text all typed in ready to go for you and all you have to do is press “send”. Ok, this was pretty good but I really didn’t want to take my phone out of my pocket, find a notification and tap on it, wait for it to load, and then press send. I wanted to just press the switch on the way out the door and have the message automatically send. After Launch Center Pro didn’t turn out quite the way I wanted, I despaired for a little while and didn’t give much thought to it. Then one day I had an idea. I’m a follower of the Sparks Floyd Methodology so I’m using the Mac app Hazel to watch files and folders and sort things for me. One of the folders Hazel watches is my Dropbox folder. So what if I can have IFTTT upload a file to my Dropbox and have Hazel do something with it? Hazel also has the ability to run Applescripts (Apple’s built in scripting language, overview here). So would it be possible to have IFTTT upload a file to my Dropbox when it sees the Long Press on the WeMo Light Switch and then have Hazel see that file, run an Applescript to fire off an iMessage through the messages app and then move that file to the trash?


It turns out it is, here is how it goes:

IFTTT sees the long press and uploads a text file to Dropbox called lfw.txt (Leaving for work).

 Screen Shot 2014-07-20 at 9.22.43 AM

 You must fire this off once before proceeding to set up your Hazel rule so that it will create the folder path in your Dropbox.  

After this, I created the apple script.

Screen Shot 2014-07-20 at 9.19.32 AM

This took a little tweaking, the “buddy” must be set to the recipient’s iCloud email or phone number and they must be set up to receive iMessages at this address/phone number. Also, the “E:email address” must be your iCloud account email you’re signed into iMessages with on that particular device. When I first tried this, I didn’t have the “delay 10” in there and it seemed to open and close the Messages app too fast to actually send the messages, adding the “delay 10” seemed to fix this. I must also mention that I don’t really know anything about Applescripts so this may require some tweaking on your particular system. 

Next I made the Hazel rule,


This part is pretty straight forward, except I think it’s important to note not to forget to set up the last part of the rule to throw the file away at the end or else this won’t work the second time you try it because IFTTT will then upload a text file called lfw-2.txt which won’t fire off your Hazel rule.

So, in closing, I wanted to point out a couple of restrictions you might face in implementing this. First of all, you must have a Mac at home running all the time with Hazel on it and the messages app. Secondly, this will only send messages through iCloud accounts so your intended recipient must also have a Mac or iOS device with this capability. But it works for me and can probably be modified to suit a lot of other purposes. 




2 thoughts on “My Robots Are Talking To You

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s