Setting Web Proxy Breaks in Tiger

The below script worked find under Panther (for setting a web proxy in Network Settings), but in Tiger it breaks when trying to select Ethernet from the Network Status Menu.

It gives the error → System Events got an error: NSReceiverEvaluationScriptError: 4

I tried using an app that dislpays the names of applescript objects in the hopes that I could find what has changed but was unable to solve the issue. Any suggestions would be greatly appreciated.

here’s the script

set the proxyServerFile to “:Library:WebServer:Documents:proxy_host.txt”
set the proxyPortFile to “:Library:WebServer:Documents:proxy_port.txt”
set proxyServerFile to open for access proxyServerFile
set proxyServer to (read proxyServerFile)
close access proxyServerFile

set proxyPortFile to open for access proxyPortFile
set proxyPort to (read proxyPortFile)
close access proxyPortFile

–set proxyServer --to proxyServerFile
–set proxyPort --to proxyPortFile

tell application “System Preferences”
activate
set current pane to pane “com.apple.preference.network”
end tell
tell application “System Events”
get properties
tell process “System Preferences”
tell window “Network”
– code nose dives here!
click pop up button 2
click menu item “Built-in Ethernet” of menu “OtherViews” of pop up button 2
tell group 1
tell tab group 1
delay 1
click radio button “Proxies”
try
click button “Click the lock to make changes.” of window “Network” of process ¬
“System Preferences” of application “System Events”
end try
tell group 1
tell table 1 of scroll area 1
set selected of row 2 to true
click checkbox of row 1
if value of (checkbox 1 of row 2) is 1 then
set outStr to "Turned Web Proxy ON " & return ¬
& “(set to '” & proxyServer & “:” & proxyPort & “')”
– else
– set outStr to “Turned Web Proxy OFF”
end if
end tell
tell group 1
set value of text field 2 to proxyServer
set value of text field 1 to proxyPort
end tell
end tell
end tell
end tell
click button “Apply Now”
end tell
end tell
end tell

thanks for the reply.

the code still nose dives with the same error message and at the same area in the code.

→ click pop up button 2