Solved

Set proxy Menue error.

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Image decoding from Camera 3 48
C3-->D3 Line Chart 4 19
Not needed 13 58
Bootstap Icons 3 22
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now