Created
May 9, 2019 17:03
-
-
Save kevin-funderburg/ff532cafb8cec46cd035cf6a5a1ff333 to your computer and use it in GitHub Desktop.
Wi-fi toggle for macs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set device to do shell script "networksetup -listallhardwareports | awk '$3==\"Wi-Fi\" {getline;print}' | awk '{print $2}'" | |
set power to do shell script "networksetup -getairportpower " & device & " | awk '{print $4}'" | |
if power is equal to "on" then | |
set power to "off" | |
else | |
set power to "on" | |
end if | |
do shell script ("networksetup -setairportpower " & device & " " & power) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment