Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Set proxy Menue error.

Posted on 2012-04-08
4
Medium Priority
?
488 Views
Last Modified: 2012-06-27
Hi,
Im trying to create a nice menue to change my proxy settings.
I get an error on line 33 - 'Object requierd"'
I dont understand why - Can you help here?
ProxyMenu.txt
0
Comment
Question by:Elad-It
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 10

Expert Comment

by:rscottvan
ID: 37821151
On line 40, and again on 55, you have the command "close()".  This is not valid VBScript code.  If you're trying to drop out of the code for some reason, the command is "wscript.quit ([error code number])".  The error code is optional.

It looks like you don't need either of those lines at all.

Regarding the line number not matching up, the error code calls out line 33, which is the 33rd line of vbscript, or line 40 of the overall file.

http://msdn.microsoft.com/en-us/library/fw0fx1aw(v=vs.85).aspx
0
 
LVL 46

Accepted Solution

by:
aikimark earned 2000 total points
ID: 37822050
Change to:
				set objShell = CreateObject("WScript.Shell")

Open in new window


I found a couple of other errors and corrected them
<html>
<head>
<title>MY Proxy</title>
<HTA:APPLICATION 
     ID="objProxy" 
     APPLICATIONNAME="Proxy Seclector"
     SCROLL="no"
     SINGLEINSTANCE="yes"
	 CONTEXTMENU ="yes"
	 MAXIMIZEBUTTON="no"
	 SELECTION ="no"
	 BORDER="dialog"
>
</head>

<SCRIPT LANGUAGE="VBScript">

	Sub Window_onLoad
        window.resizeTo 250,210
    End Sub 

    Sub SelectProxy
        For Each objOption in OptionChooser.Options
            If objOption.Selected Then
				Value=objOption.value
				Exit For
            End If
        Next
		
		Select Case Value 
	
			Case "1" 
				set objShell = CreateObject("WScript.Shell")
				objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer", "MyServer:111"
				objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 1, "REG_DWORD"

			Case "2" 
				set objShell = CreateObject("Shell.Application")
				objShell.ShellExecute "iexplore", "", "", "open", 1
				Set objShell = Nothing 
				close()

			Case "3" 
				Set objShell = CreateObject("Wscript.Shell")
				objShell.Run("iexplor"),1,True
				Set objShell = Nothing

			Case "4" 
				set WSHShell = CreateObject("WScript.Shell")
				WSHShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer", "MyServer:111"
				WSHShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 0, "REG_DWORD"
				set objShell = nothing

			Case "5" 
				close()
				strFlag = True 
	
		End Select 
    End Sub

</SCRIPT>

<body>
<h1>Proxy Menue</h1>
<select size="1" name="OptionChooser" >
    <option value="" style="color:#ff0000">Choose Country</option>
    <option value="1">Canada</option>
    <option value="2">Country2</option>
    <option value="3">Country3</option>
    <option value="4">Clear Settings</option>
    <option value="5">Quit</option>
</select>
<br>
<br>
<input type="button" onclick="SelectProxy" value="OK" />

</body>
</html>

Open in new window

0
 

Author Closing Comment

by:Elad-It
ID: 37822996
Super thanks guys!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question