Solved

Set proxy Menue error.

Posted on 2012-04-08
4
483 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
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 45

Accepted Solution

by:
aikimark earned 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this post we will learn different types of Android Layout and some basics of an Android App.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

685 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