Currently I can do this only on a per connection basis using this script:
property status : "none"
property val : "none"
on get_status()
set status to do shell script "sudo networksetup -getnetworkserviceenabled Ethernet" as string
end get_status
get_status()
if status is "Enabled" then
set val to "off"
else
set val to "on"
end if
do shell script "sudo networksetup -setnetworkserviceenabled Ethernet " & val
get_status()
display dialog "Status: " & status with title "Network Toggle" buttons {"OK"} default button 1
But recently I am getting network from different sources and I would like to have a script with toggles availability for all active connections (either all on or all off).
Any idea on how I could pull this off?