Toggle Airport On and Off

May 24, '11 07:30:00AM

Contributed by: joseph1933

The hint 'Control Airport Without Menu Bar' in the June issue of Macworld (also see this article) was very informative and useful. I devised a simple script based on the article hint that toggles airport on and off.

Here is the script. Copy and Paste it into AppleScript Editor and save it as an Application.

--
-- Toggle Airport Power On and Off
--
if (offset of "On" in (do shell script "networksetup -getairportpower en1")) > 0 then
	do shell script "networksetup -setairportpower en1 off"
else
	do shell script "networksetup -setairportpower en1 on"
end if

[crarko adds: I tested this, and it works as described. It follows precisely the method described in the linked Macworld article, in case you hadn't seen that.]

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20110522082622506