Windows Scripting can't find reference

0

I have a windows script file that doesn't work anymore.

The script look like this

<job>
    <reference object="Some.Component.1" />
    <script language="VBScript">

x = CreateObject("Some.Component.1")
MsgBox TypeName(x)

    </script>
</job>

When I run the script with cscript or wscript I get the error

Windows Script Host: Cannot find the type library for this reference : Some.Component.1

The error code is 0x80040068 which means "Invalid index". (I tried to removed the .1 index but it didn't work)

The strange thing is that if I remove the line <reference object="Some.Component.1"/>, the CreateObject line works and the object is created.

I know the script worked about a year ago. The "Some.Component" library has been updated but since CreateObject works I have no idea what is wrong with it.

I have tested the script on Server 2008 R2 (64bit), Server 2003 (32bit) and Windows 7 (64bit) with the same error.

Some.Component is 32 bit. For the 64bit machines I used cscript, wscript in the SysWow64 folder.

(I need the <reference../> to access enums within the component)

com
vbscript
wsh
asked on Stack Overflow Aug 31, 2011 by adrianm

1 Answer

1

The type library is not registered. This is a different and separate thing from the object being registered. Usually the control will do both.

I suggest you first try unregistering and re-registering the DLL.

regsvr32.exe /u c:\path\to\control.dll
regsvr32.exe c:\path\to\control.dll

If that doesn't work, try using RegTLib.exe to register the type library (*.tlb) directly.

regtlib.exe c:\path\to\control.dll

OR

regtlib.exe c:\path\to\control.tlb

Note that the type library may be a separate file or may be embedded in the DLL.

For more on regTLib.exe see here:

answered on Stack Overflow Jan 30, 2012 by Ben

User contributions licensed under CC BY-SA 3.0