Solved

Set proxy Menue error.

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

773 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