0

I am having some trouble trying to set the proxies. Most of the code (below) works ok, I can capture the variables ok, however I cannot effectively pass them to the command, this syntax works great when setting the computername etc, but not with this command. I continuously get the error :

"error "** Error: The parameters were not valid." number 4"

I am told I may need to use a echo command and a pipe from this document

However, I am unable to get the syntax right. The end goal is obvious, I need to prompt for a username and PW and then set the proxies for a given interface.

My Script:

set myUser to text returned of ¬
    (display dialog "Enter Your email address" with title ¬
        "My Proxy Setup" default answer ¬
        "" buttons {"Continue…"} ¬
        default button 1 ¬
        )
set myPassword to text returned of ¬
    (display dialog "Enter Your corporate password" with title ¬
        "My Proxy Setup" default answer ¬
        "" buttons {"Continue…"} ¬
        default button 1 ¬
        )
**do shell script "/usr/sbin/networksetup -setsecurewebproxy Wi-Fi domain.com 8443 On" & myUser & myPassword**
David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205
cybersurfr
  • 21
  • 5

1 Answers1

0

I don't know anything about this command but you're missing spaces around the username and password. You may also need to quote some of the variables to ensure the command reads them as intended. Try it this way...

do shell script "/usr/sbin/networksetup -setsecurewebproxy 'Wi-Fi' 'domain.com' 8443 On" & space & quoted form of myUser & space & quoted form of myPassword

Also you may want to use the "hidden answer" option when getting the password...

set myPassword to text returned of ¬
    (display dialog "Enter Your corporate password" with title ¬
        "My Proxy Setup" default answer ¬
        "" buttons {"Continue…"} ¬
        default button 1 ¬
        hidden answer true ¬
        )

Good luck.

regulus6633
  • 18,848
  • 5
  • 41
  • 49