Keyboard Maestro Macro: Based on my Wifi, Do This

With the ability to now trigger macros based on WiFi, I’ve come up with a doozey of a macro that I have been using as a sort of “geofenced” WiFi trigger for certain settings on my Mac. I like my computer to look and act a certain way at work, differently at home, and differently…

With the ability to now trigger macros based on WiFi, I’ve come up with a doozey of a macro that I have been using as a sort of “geofenced” WiFi trigger for certain settings on my Mac.

I like my computer to look and act a certain way at work, differently at home, and differently everywhere else. ((A few people have mentioned [Control Plane][1] to me, but in looking at it I prefer to stay with Keyboard Maestro.)) In the past I had a ton of Keyboard Maestro macros that I would invoke quickly to setup my computer — but no more (well *mostly* no more).

My WiFi actions macro. (full-size here, open that in a new tab.)

Instead I now have my computer tweak a few settings based on the WiFi network I am connected to. To the right you can see the macro, but I think I should walk you through this in case you aren’t familiar with some of the tools I am using.

First the macro is being triggered by connection to *any* WiFi network, that is what the `.` denotes. The reason for this is simple: I want to do something specific if I connect to any other network than the ones I specify. This works well for me because I only have two “trusted” networks (my home network and office network).

What follows for the actions is a large if/then statement inside the macro. The first condition checks to see if the WiFi network is my office network. If it is, then the macro sets the volume of my computer to `0%` and executes an AppleScript that turns *on* notification center. Lastly the macro hides all Safari windows — *WHO KNOWS* what I was looking at last.

The next test is to see if I am on my home network (aptly named “Comcast is Probably Down” — a name that never ceases to make me grin). If I am home, then I turn my volume to `60%`, turn *on* notification center and leave it at that.

The last is the `else` statement, meaning if my computer connects to any WiFi network that is not one of the two above, here’s what needs to be done. My assumption is that I have either connected to a coffee shop network, or am in another office for some reason (or another person’s house) either way, I want certain things to happen. ((I should note that I *could* set it up to act if I tether, but I have not done that because it would almost be identical to the else action.)) First, volume to `0%` again, because why wouldn’t you be polite? Next some mouse clicks, which are currently the only way I know how to automate turning on my VPN — which is what those mouse clicks do. From there I set my wallpaper to a specific background, which is all black for good measure. I hide Safari windows — I already touched on why. Then I turn *off* notification center. Lastly, I send a notification to let me know I am on such a sketchy network as to need all these precautions, but that the macro ran to protect me anyways.

You can add as many intermediate WiFi network checks as you want, and you can add tons of actions to each one. Previously, I did some of this with time triggers, but those weren’t fool-proof and this method has yet to fail me — I love it.

## Further Playing

I’ve also toyed with the idea of having KM take all the open tabs in Safari, grab the URLs, send them to Instapaper (or bookmark them) and then close Safari. That’d be something I would do if I was more presentation oriented, but I can’t remember the last time I presented something.

## Sum

My ultimate goal is to just be able to close the lid on my laptop, and open the lid, without having to worry who is sneaking a peek, or what I was doing last.

[1]: http://www.controlplaneapp.com

Note: This site makes use of affiliate links where and when possible. These links may earn this site money when utilized. 

BECOME A MEMBER

Join Today, for Exclusive Access.


Posted

in

by