I’m using code below to connect net and it works fine. But it asks password. How i can input password automatically or detect when it shows password dialog box?
do shell script "networksetup -connectpppoeservice " & service
Another problem is that code below fails to disconnect:
do shell script "networksetup -disconnectpppoeservice " & service
This script turns net on successfully but fails to turn off. Why?
set serv to "your service name here"
if (do shell script "networksetup -showpppoestatus " & serv) is "disconnected" then
say "trying to turn on"
do shell script "networksetup -connectpppoeservice " & serv
say "network on"
else
say "trying to turn off"
do shell script "networksetup -disconnectpppoeservice " & serv user name "username" password "password" with administrator privileges
say "network off" --fails to turn network off but still says network off
end if