Switch proxy's Automator-workflow shell script

Source: Internet
Author: User

A script developed for colleagues to quickly switch the environment of the home and Unit

Tell application "system events"

Set proxy_dialog to display dialog "proxy module (Ethernet version):" Buttons {"enable proxy Mode 1", "enable proxy Mode 2 ", "Disable proxy"} default button "enable proxy Mode 1"
With title "quickly switch proxy app in Huaxia Fund Development Environment"

Set proxy_interface to button returned of proxy_dialog

End tell

If proxy_interface is "enable proxy Mode 1" then

Do shell script "networksetup-setwebproxy Ethernet 11.1.1.1 3128 & networksetup-setsecurewebproxy Ethernet 1.1.1.111 8080 & networksetup-setwebproxystate Ethernet on & networksetup-setsecurewebproxystate Ethernet on" with Administrator
Privileges

End if

If proxy_interface is "enable proxy Mode 2" then

Do shell script "networksetup-setwebproxy Ethernet 1.1.1.1 3128 & networksetup-setsecurewebproxy Ethernet 1.1.1.1 8080 & networksetup-setwebproxystate Ethernet on & networksetup-setsecurewebproxystate Ethernet on" with Administrator
Privileges

End if

If proxy_interface is "Disable proxy" then

Do shell script "networksetup-setwebproxystate Ethernet off & networksetup-setsecurewebproxystate Ethernet off" with administrator privileges

End if

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.