Solved

Set proxy Menue error.

Posted on 2012-04-08
4
485 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 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Part One of the two-part Q&A series with MalwareTech.
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…
Simple Linear Regression
Suggested Courses

636 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