System preferences setting proxies in network pane

Hi all

I am currently working on a script to bind machines to a network & setup network preferences like dns & other such items, I have got as far as setting the proxies & currently I can set just the FTP proxy, the problem is I can’t select item 2 in the list which is Web Proxy (HTTP)

Currently my script (just for this section) is as follows:


activate application "System Preferences"
tell application "System Events"
	tell process "System Preferences"
		set frontmost to true
		click pop up button 2 of window "Network"
		delay 0.5
		click menu item "Built-in Ethernet" of menu 1 of pop up button 2 of window "Network"
		delay 0.5
		perform action "AXPress" of radio button "Proxies" of tab group 1 of group 1 of window "Network"
		
-- once here you should be in the proxies tab of your network adapter named Built in Ethernet 
		
	end tell
end tell

]

After I have got here I am stuck because I can set the first item because it’s already selected but I can’t move onto the second item in the list.

Any help would be greatly appriciated.

thanks for reading

Dave

A quick google search turned up these which may help…

http://www.macosxhints.com/article.php?story=2003101617122867
http://www.apple.com/applescript/features/system-prefs.html

Hi,

the second link describes ways to script System Preferences in Leopard
Dave’s script is doubtless written for Tiger. :wink:

BTW: In Leopard the proxies could be set via command line (/usr/sbin/networksetup)

Thanks for the prompt replies.

Currently looking at that first link, & yes it’s for 10.4, appologies I should of started that.

I’ll probably go with the first link as a soloution looks to work but I’d still like to overcom eht einitial problem, for curosity as mucha s anything.

I now have this little bit of code:


Set focused of table 1 of scroll area 1 of group 1 oftab group 1 of window "network" to true

this is the last bit in my script currently & it should set the focus to the table of proxy’s you can set (ftp proxy, web proxy etc). I am using UI browser & if I use the tick box in the program to set the attribute it works fine, add it to my script & I get a NsInternalScriptError

any ideas would be greatly appriciated! and again thanks for your replies!

Dave

EDIT

The first link doesn’t work gets to the line


click checkbox "Web Proxy (HTTP)"

& returns the same error as above.