The title pretty much sums it up. I want to avoid having to use the trackpad to connect to certain networks. This comes up often when a new network becomes available but I'm already connected to another one.
How to write an AppleScript which when run will connect to a specific WIFI network if available
applescriptNetworkwifi
Related Question
- MacOS – How to make OSX scan for available WiFi networks now
- Connect to second Wifi network using dongle
- How to Use WiFi Only for Handoff on macOS
- MacBook – Programmatic access to connect to a wifi network
- Dual WiFi network cards route outgoing traffic to specific cards
- MacOS – How to get the Mac to automatically connect to a given network whenever it becomes available
- Network – How to Prevent Users on Mac from Connecting to Any WiFi Networks Except White-Listed Ones
Best Answer
One way to do this to use the terminal command:
from a script. Here's a simple Python script that will do this:
and this runs fine from inside Keyboard Maestro or TextExpander after you define a single keystroke to run it.
You can run these commands from AppleScript instead - I just get tired of trying to guess the right syntax for everything...