Setting up proxy for Safari.

Every day i have to change all my proxy settings on my Mac to set up Safari, and Adium to get though our VPN system. I then got the idea to make a AppleScript to click them on for me, insted of me click so many times every day. I found one to Adium, so that was no problem, but then i needed one for Safari. I started google around and found:

This seems to work just fine, but not in Leopard. I then tried to use Automator to record it, since its bascily just: Apple → System Settings → Network → Airport → Advanced - > Proxy → “Click” them → Ok → Apply → Exit. But using the record function in Automator failed. I then tried to look at what i already had, a script for older version OSX and tried to write something, but got stuck so hope somebody could help me.

It fails when i comes to the “Network” screen, and needs to click “Advanced” - i the error starts here, in the AppleScript document i linked to above:

click pop up button 2

So right now i have in my own document:

set proxyServer to "localhost"
set proxyPort to "8118"

tell application "System Preferences"
	set current pane to pane ""
end tell
get properties
tell window "Netværk"

end tell

I hope someone can help me, since im stuck. Thanks.

Bump :confused:

Sorry, no scripting help on this from me. Doing UI scripting to accomplish this is probably possible, but it would probably be tedious and error prone.

Would creating an alternate network ˜Location’ work for you (in the Network control panel)? Then you could easily switch between proxied and unproxied settings by changing locations in from the Apple menu. With the change in proxy settings you could also change DNS settings (which is often needed to resolve the host names of machines on the other side of the VPN).

Since you use Leopard, you can use the Network Preferences suite of System Events to set up the proxy setting. However, in Leopard, you can simply assign a separate set of proxy setting for your VPN connection (as long as it’s based on L2TP/IPSec or PPTP).

How do i do that? I cant seem to find the option for it.

Using the following images to guide you

Proxy setting:

This is not an AppleScript solution, but it’s also not always the case that AppleScript is the answer to all questions.

Marco Polo