Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Toggle a proxy server on and off via scripts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Toggle a proxy server on and off via scripts
Authored by: paulnojustpaul on Mar 05, '08 01:51:53PM

Maybe I'm missing something here, wouldn't it be easier just to have two network locations, one with the proxy set, the other without, and switch between the two? You can then also set keyboard shortcuts for each using QuickSilver and the like.

[ Reply to This | # ]
Toggle a proxy server on and off via scripts
Authored by: sveiki on Mar 06, '08 12:26:10AM
Seems to me like this would work just fine, as well. I also did not think to explore this option. The reason I have it set up this way is to quickly change my proxy setup to download a file or two and then quickly switch it back. Switching network locations could have one issue that might be problematic if the system insists on disconnecting and reconnecting to networks or renewing a DHCP lease (I'm not sure if this is the case. Other reasons networksetup might be a good option:
  • It never hurts to have multiple solutions.
  • Scripting proxy changes could be useful in some situations (ie doing something else via script or programmatically).
  • Possibly faster.
  • No need for additional network locations just to have choices for "Proxy On" and "Proxy Off". If you already have a few network locations, this just might be important.

[ Reply to This | # ]
Toggle a proxy server on and off via scripts
Authored by: hj45lp on May 30, '10 03:56:15AM

The other days I stayed at a hotel with wireless, and I wanted to use a SOCKS proxy (ssh) for accessing machines inside my company network and also for security: the hotel does not need to know what I am looking at. I have two locations set up with and without proxy. I needed a no-proxy location to enter the password for the wireless access, but when thereafter switching to the proxy location, Airport disconnected and reconnected, and the hotel's system required me to enter my password again, but for doing that I needed the no-proxy location. Argh! So the only way was going into System Preferences and toggle the proxy on/off.

This hint enables me to automise the process, always toggling the proxy on before starting ssh to create the socks proxy.

While I am not using the applescript solution this pointed me to the networksetup utility. Big thank you for that! And I confirm that that utility also works in Snow Leopard.


[ Reply to This | # ]