Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chown33

Moderator
Staff member
Aug 9, 2009
10,758
8,451
A sea of green
I don't know a way to do this entirely in AppleScript.

However, the 'networksetup' command can turn Airport (i.e. WiFi) off and on, and also return its current on/off state. So based on that, it's definitely possible to make a shell script that can toggle Airport.

But you already said you've seen shell scripts and they didn't work. So post the URL of a shell script that didn't work, and I can take a look.

You should also describe what you mean by "didn't work". "Didn't work" provides nothing useful, because there are millions of ways something can not work. If you were diagnosing an automobile problem, "didn't work" could mean anything from "the key won't fit in the ignition" to "the engine exploded".

Describe what you expected to happen, then describe what actually did happen, including the exact text of any error messages.

Also identify your OS version and what Mac model you're running. This is necessary because networksetup resides in different places on different OS versions, or doesn't exist at all in some cases.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.