AppleScript 修改Wifi 指定IP 或关闭指定

167B621C-0F67-466A-96DD-B04BD1A49F9F

set userCanceled to false
try
    set dialogResult to display dialog ¬
        "将IP设置为指定的IP地址" buttons {"否", "是"} ¬
        default button "是" cancel button ¬
        "否" giving up after 15
on error number -128
    set userCanceled to true
end try

if userCanceled then
    -- statements to execute when user cancels
    do shell script "echo \"******\" | sudo -S networksetup -setdhcp \"Wi-Fi\""
else
    do shell script "echo \"******\" | sudo -S networksetup -setmanual \"Wi-Fi\" 192.168.2.131 255.255.255.0 192.168.2.1"
end if

****** 为你的电脑的密码。