It’s the same process every work day. I get into the office. I sit down and my desk and open up the MacBook Pro. A few times each week, I get connected to the wrong WiFi network. When this happens, I automatically connect to “xfinitywifi” rather than my own office’s WiFi network. Unless I specifically look at which network I’m using, I don’t discover this until I notice that my internet connection is very slow. A similar problem exists at home, when I get connected to a neighbor’s WiFi.
I know that I can go into the Network panel in the System Preferences and simply delete “xfinitywifi” but every once in a while I use other networks with the same name so I don’t want to have to re-renter my credentials each time. In case you were wondering, my home and office networks are the top two networks in the list, so they have priority over all the other networks. I just don’t know why I get connected to this network when my office’s wireless router is 15 feet away.
OK. so this isn’t the biggest problem. But I wondered if there could be an automated solution to put me on the right network. So I turned to Keyboard Maestro and came up with the following macro (click image for larger pop-up):
This macro executes every time the lid of the MacBook Pro is opened. If the current WiFi network is any of the 3 listed networks (HomeNetwork, WorkNetwork, and iPhone6), then nothing happens. If the current WiFi network is not one of the 3 listed networks, then a sound is played and an AppleScript is executed.
The AppleScript is a one line script that runs a shell command:
do shell script “networksetup -setairportnetwork en0 ‘WorkNetwork’ my_password”
Now I need a solution to the far less common problem of getting connected to other networks when my network drops out for a few minutes! Update coming soon……