Closed Bug 362280 Opened 18 years ago Closed 18 years ago

I can not get Mozilla to execute a VBScript Function

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 41274

People

(Reporter: jareth_2005, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

This extact htm  file works in explorer. 

I am a database manager as well and I wrote a web page that uses VBScript  and WMI registry functions to update database entries in the registry.

The Console error is 
Error: cmdInstallODBC is not defined
Source File: file:///H:/ODBC%20Application/index.htm
Line: 1




<HTML>
<HEAD>
<meta name=keywords content="ODBC Configuration Tool">
<TITLE>ODBC Configurations</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<script LANGUAGE="VBScript"> 
<!--
OPTION EXPLICIT

SUB cmdInstallODBC	
	DIM user, pass, computer

	user = Document.Form1.txtUsername.Value
	pass = Document.Form1.txtPassword.Value
	computer = Document.Form1.txtComputer.Value

	InstallOnComputer computer, user, pass
	MSGBox ("Complete")
END SUB

SUB InstallOnComputer(strComputer, user, pass)
	Install_SLX_SQL_ODBC "SALESLOGIX_ODBC", strComputer, user, pass
	Install_SLX_SQL_ODBC "AEGIS SUPPORT ODBC", strComputer, user, pass
END SUB

SUB Install_SLX_SQL_ODBC(strConnectionName, strComputer, user, pass)
	CONST HKEY_LOCAL_MACHINE = &H80000002
	CONST DATABASE = "SLXProduction"
	CONST DRIVER = "C:\WINDOWS\System32\Sqlsrv32.dll"
	CONST LASTUSER = "sysdba"
	CONST SERVER = "srv-sldata"

	DIM SWBemlocator, WMIService, objRegistry
	DIM strKeyPath

	IF strComputer <>  "." THEN
		ON ERROR RESUME NEXT
		SET SWBemlocator = CreateObject("WbemScripting.SWBemlocator")
		IF ERR THEN
			MSGBox ("Can not create Bemlocator " & CSTR(ERR))
			ON ERROR GOTO 0
			EXIT SUB
		END IF
		SET WMIService = SWBemlocator.ConnectServer(strComputer, "\root\default", user,pass)
		IF ERR THEN
			MSGBox ("Can not create WMI Service " & CSTR(ERR))
			ON ERROR GOTO 0
			EXIT SUB
		END IF
		SET objRegistry = WMIService.Get("StdRegProv")
		IF ERR THEN
			MSGBox ("Can not create Registry Object " & CSTR(ERR))
			ON ERROR GOTO 0
			EXIT SUB
		END IF
	ELSE
		SET objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
		IF ERR THEN
			MSGBox ("Can not create Registry Object")
			ON ERROR GOTO 0
			EXIT SUB
		END IF
	END IF

	strKeyPath = "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources"
	objRegistry.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath, strConnectionName,"SQL Server"
	IF ERR THEN
		MSGBox ("Can not create Registry key " & strKeyPath & strConnectionName & " (SQL Server) " & CSTR(ERR))
		ON ERROR GOTO 0
		EXIT SUB
	END IF
	strKeyPath = "SOFTWARE\ODBC\ODBC.INI\" + strConnectionName
	objRegistry.CreateKey HKEY_LOCAL_MACHINE, strKeyPath
	IF ERR THEN
		MSGBox ("Can not create Registry key " & strKeyPath & " " & CSTR(ERR))
		ON ERROR GOTO 0
		EXIT SUB
	END IF
	objRegistry.SetExpandedStringValue HKEY_LOCAL_MACHINE, strKeyPath,"Database", DATABASE
	IF ERR THEN
		MSGBox ("Can not create Registry key " & strKeyPath & " Database (" & DATABASE & ") " & CSTR(ERR))
		ON ERROR GOTO 0
		EXIT SUB
	END IF
	objRegistry.SetExpandedStringValue HKEY_LOCAL_MACHINE, strKeyPath,"Driver", DRIVER
	IF ERR THEN
		MSGBox ("Can not create Registry key " & strKeyPath & " Driver (" & DRIVER & ") " & CSTR(ERR))
		ON ERROR GOTO 0
		EXIT SUB
	END IF
	objRegistry.SetExpandedStringValue HKEY_LOCAL_MACHINE, strKeyPath,"LastUser", LASTUSER
	IF ERR THEN
		MSGBox ("Can not create Registry key " & strKeyPath & " LastUser (" & LASTUSER & ") " & CSTR(ERR))
		ON ERROR GOTO 0
		EXIT SUB
	END IF
	objRegistry.SetExpandedStringValue HKEY_LOCAL_MACHINE, strKeyPath,"Server", SERVER
	IF ERR THEN
		MSGBox ("Can not create Registry key " & strKeyPath & " Server (" & SERVER & ") " & CSTR(ERR))
		ON ERROR GOTO 0
		EXIT SUB
	END IF

	SET WMIService = NOTHING
	SET objRegistry = NOTHING
	SET SWBemlocator = NOTHING
END SUB

//-->
</SCRIPT>
</HEAD>
	<FORM NAME="Form1">
		<B><TT><LABEL FOR="USERNAME">Username</LABEL></TT></B>
		<INPUT TYPE=TEXT NAME="USERNAME"ID=txtUsername VALUE=""><BR>
		<B><TT><LABEL FOR="PASSWORD">Password</LABEL></TT></B>
		<INPUT TYPE=password NAME="PASSSWORD" ID=txtPassword VALUE="">
		<HR>
		<B><TT><LABEL FOR="COMPUTER">Computer</LABEL></TT></B>
		<INPUT TYPE=TEXT NAME="COMPUTER" ID=txtComputer></BR>
		<BR>
		<INPUT TYPE=BUTTON NAME="InstallODBC" VALUE="Install ODBC"; OnClick =cmdInstallODBC><br>
	</FORM>
</HTML>


Reproducible: Always

Steps to Reproduce:
1.Open the supplied web page
2.
3.

Actual Results:  

Error: cmdInstallODBC is not defined
Source File: file:///H:/ODBC%20Application/index.htm
Line: 1

Expected Results:  
A Message Box with an error a a Message Box saying Complete

Can Mozilla run VBScript

*** This bug has been marked as a duplicate of 41274 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.