Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

preswang

macrumors newbie
Original poster
Jul 4, 2010
3
0
i write an AppleScript for MACOS(SL tested) http and https Proxy on and off set.
Maybe help someone who need it.:)
 

Attachments

  • proxyset.zip
    27.1 KB · Views: 313
  • proxyset.png
    proxyset.png
    31.8 KB · Views: 298
How very dangerous. How do we know that we can trust you? What is to top it from being a virus?

Cool idea though and thanks for the upload if it is legit. What does it do exactly? Will you be able to read any of the info?
 
hey, it's what it contains:
you can put the code in your AppleScript

-- Set http(s) Proxy On-Off
-- Author: lasse
-- MAC OS Version: OSX/SnowLeopard
-- Date: 7/4/2010
tell application "Finder"
set proxy_dialog to display dialog "Set Http and Https Proxy Open or Close. Select Interface:" buttons {"AirPort On", "Ethernet On", "All off"} default button "Airport On" with title "Http(s) Proxy Settings On-off"
set proxy_interface to button returned of proxy_dialog
end tell

if proxy_interface is "AirPort On" then
do shell script "networksetup -setwebproxystate airport on"
do shell script "networksetup -setsecurewebproxystate airport on"
end if

if proxy_interface is "Ethernet On" then
do shell script "networksetup -setwebproxystate ethernet on"
do shell script "networksetup -setsecurewebproxystate ethernet on"

end if

if proxy_interface is "All off" then

do shell script "networksetup -setwebproxystate airport off"
do shell script "networksetup -setsecurewebproxystate airport off"

do shell script "networksetup -setwebproxystate ethernet off"
do shell script "networksetup -setsecurewebproxystate ethernet off"
--return
end if
 
proxy script

Hi

I am looking for a script like the one below to set proxies ie auto proxy file etc and to remove proxy settings thst users have had set

the script I have is a shell script but I keep getting syntax errors

Could someone help

#! /bin/bash
###
# Network device to be managed.
# more options exist other than these, run ‘networksetup -listallnetworkservices’ from the terminal
###
if [[ `networksetup -getairportpower "Airport" | awk '{ print $4 }'` == "On" ]]; then
device=”Airport”
else
device=”Ethernet”
fi
if [[ `scutil --proxy | grep ProxyAutoConfigEnable | awk '{ print $3 }'` == "1" ]]; then
proxyState=”enabled”
else
proxyState=”disabled”
fi
if [[ "$proxyState" == "enabled" ]]; then
networksetup -setautoproxyurl $device ” “
networksetup -setautoproxystate $device off
proxyState=”disabled”
imagepath=”${1}Contents/Resources/proxy_disconnected.icns”
else
networksetup -setautoproxyurl $device “http://yourproxyserver.edu/proxy.pac”
proxyState=”enabled”
imagepath=”${1}/Contents/Resources/proxy_connected.icns”
fi
capProxyState=`echo “${proxyState:0:1}” | tr a-z A-Z`
capProxyState=$capProxyState${proxyState:1}
if [[ -e /usr/local/bin/growlnotify ]]; then
/usr/local/bin/growlnotify –image “$imagepath” -m “Proxy Server is now $proxyState.” -t “Proxy Server $capProxyState”
else
echo “$proxyState”
fi
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.