Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

invalid name error

36 views
Skip to first unread message

TJS

unread,
May 10, 2003, 12:20:28 AM5/10/03
to
getting invalid name error when attempting to register component
can anyone tell me what is wrong with this wsc registration code?

also will not generate typelibrary

///////////////////////////////////////////////////////////////////////////

<registration
description="Sample Math"
progid="NewMath2.wsc"
version="1.00"
classid="{CE8E8350-825B-11D7-967A-D752AC14093B}"

<script language="VBScript">
<![CDATA[

Function Register()
Set oTL = CreateObject("Scriptlet.TypeLib")
oTL.AddURL "c:\wsc\components\NewMath2.wsc" ' Script component
URL.
oTL.Path = "c:\wsc\components\NewMath2.tlb" ' .tlb path.
oTL.Doc = "NewMath2 typelib" ' Documentation string.
oTL.GUID = "{CE8E8354-825B-11D7-967A-D752AC14093B}"
oTL.Name = "NewMath2TLib" ' Internal name for tlb.
oTL.MajorVersion = 1
oTL.MinorVersion = 0
oTL.Write ' Write tlib to disk.
oTL.Reset ' Clear list of URLs in AddURL/.
End Function
]]>
</script>

remotable="true">
</registration>

TJS

unread,
May 10, 2003, 4:01:39 PM5/10/03
to
found src of error msg - misplaced closing angle bracket but still it is not
generating a typelibary file in the folder

shouldn't this create a physical typelibrary file automatically ?


<registration
description="Sample Math"
progid="NewMath2.wsc"
version="1.00"
classid="{CE8E8350-825B-11D7-967A-D752AC14093B}">

<script language="VBScript">
<![CDATA[

Function Register()
Set oTL = CreateObject("Scriptlet.TypeLib")
oTL.AddURL "c:\wsc\components\NewMath2.wsc" ' Script
componentURL.
oTL.Path = "c:\wsc\components\NewMath2.tlb" ' .tlb path.
oTL.Doc = "NewMath2 typelib" ' Documentation string.
oTL.GUID = "{CE8E8354-825B-11D7-967A-D752AC14093B}"
oTL.Name = "NewMath2TLib" ' Internal name for tlb.
oTL.MajorVersion = 1
oTL.MinorVersion = 0
oTL.Write ' Write tlib to disk.
oTL.Reset ' Clear list of URLs in AddURL/.
End Function
]]>
</script>

remotable=true
</registration>


TJS wrote in message ...

Torgeir Bakken (MVP)

unread,
May 10, 2003, 5:07:19 PM5/10/03
to
TJS wrote:

> found src of error msg - misplaced closing angle bracket but still it is not
> generating a typelibary file in the folder
>
> shouldn't this create a physical typelibrary file automatically ?

> (snip)

Hi

You can compare it to the one I use, this one does generate a type library file
automatically:


<?xml version="1.0" ?>
<component>
<registration progid="BWshLib.WSC"
classid="{c8e9c3f5-043b-4aa3-97b9-781681910643}"
description="BWshLib"
version="1.14">


<script language="VBScript">
<![CDATA[
Function Register()

set oTL = CreateObject("Scriptlet.TypeLib")
oTL.AddURL "BWSHLIB.WSC"
oTL.Path = "BWSHLIB.tlb"
oTL.Doc = "Brix WSH component"
oTL.GUID = "{63284c00-7a94-4336-9e07-3923e4470980}"
oTL.Name = "BWSHLIB_tbl"
oTL.MajorVersion = 1
oTL.MinorVersion = 1
oTL.Write
oTL.Reset
End Function

Function UnRegister()
End Function
]]>
</script>
</registration>
<public>
(snip method definitions and code)


Some additional comments:

Be sure that you don't have the line
implements id="Behavior" type="Behavior"
in you WSC, or else the oTL.Write will err.


It shouldn't be necessary to hard code the path in oTL.AddURL and oTL.Path
(c:\wsc\components\).


I register it with this script line from a script:
sRetVal = oShell.Run("regsvr32 /s " & "/i:" & """" & sB_ComPath & "\BWSHLIB.WSC"

& """" & " " & sWinSysDir & "\scrobj.dll", 1, True)

that transfers to something like this on the command line:
regsvr32 /s /i:"some path\BWSHLIB.WSC" C:\WINNT\SYSTEM32\scrobj.dll

(you can of course also right click on the WSC file and select "Register", and
it will also generate a type library file automatically)


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


TJS

unread,
May 10, 2003, 5:50:02 PM5/10/03
to
thanks for the code.

I pasted it into my test wsc file and it still runs, but doesn't generate a
typelibrary file.

also did not register itself


Any help ?


Torgeir Bakken (MVP) wrote in message <3EBD6A07...@hydro.com>...

Michael Harris (MVP)

unread,
May 10, 2003, 5:46:57 PM5/10/03
to
TJS wrote:
> found src of error msg - misplaced closing angle bracket but still it
> is not generating a typelibary file in the folder
>

You still have a syntax error in the registration element. The remote=true
is not valid where it is located in the source and the format is invalid
(should be remotable="true").

Other than that I can't see anything else wrong. Since you aren't posting a
complete WSC, there could be problems elsewhere.

I suggest that you initially always include:

<?component error="true" debug="true"?>

to aid in debugging and error reporting when problems occur within the WSC
itself, even when registering.


--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US

Technet Script Center
http://www.microsoft.com/technet/scriptcenter/default.asp


TJS

unread,
May 10, 2003, 6:13:02 PM5/10/03
to
I made your suggested changes and revised classID and oTL.GUID to other
example provided
(MS website does not show qoutes on "true" in their examples)

runs but still does not self register or produce typlibrary file
tried with physical path and without

here is the code:
-----------------------------------------

<?xml version="1.0"?>
<component>

<?component error="true" debug="true"?>

<registration
description="Math"
progid="NewMath2.wsc"
version="1.00"
classid="{c8e9c3f5-043b-4aa3-97b9-781681910643}"
remotable="true"


>
<script language="VBScript">
<![CDATA[
Function Register()
Set oTL = CreateObject("Scriptlet.TypeLib")

oTL.AddURL "Newmath2.wsc" ' Script component URL.
oTL.Path = "NewMath2.tlb" ' .tlb path.


oTL.Doc = "NewMath2 typelib" ' Documentation string.

oTL.GUID = "{63284c00-7a94-4336-9e07-3923e4470980}"


oTL.Name = "NewMath2TLib" ' Internal name for tlb.
oTL.MajorVersion = 1
oTL.MinorVersion = 0
oTL.Write ' Write tlib to disk.
oTL.Reset ' Clear list of URLs in AddURL/.
End Function

]]>
</script>


</registration>

<public>
<method name="Add">
<PARAMETER name="X"/>
<PARAMETER name="Y"/>
</method>
<method name="Subtract">
<PARAMETER name="X"/>
<PARAMETER name="Y"/>
</method>
<method name="Multiply">
<PARAMETER name="X"/>
<PARAMETER name="Y"/>
</method>
<method name="Divide">
<PARAMETER name="X"/>
<PARAMETER name="Y"/>
</method>
</public>

<script language="VBScript" src="math.vbs">
<![CDATA[

private oMath
set oMath = new clsMath

function Add(X,Y)
Add = oMath.Add(X,Y)
end function

function Subtract(X,Y)
Subtract = oMath.Subtract(X,Y)
end function

function Multiply(X,Y)
Multiply = oMath.Multiply(X,Y)
end function

function Divide(X,Y)
Divide = oMath.Divide(X,Y)
end function

]]>
</script>

</component>


math.vbs
--------------
class clsMath

public function Add(X, Y)
Add = X + Y
end function

public function Subtract(X, Y)
Subtract = X - Y
end function

public function Multiply(X, Y)
Multiply = X * Y
end function

public function Divide(X, Y)
Divide = X / Y
end function

end class

Michael Harris (MVP) wrote in message ...

Torgeir Bakken (MVP)

unread,
May 10, 2003, 7:11:14 PM5/10/03
to
TJS wrote:

> I made your suggested changes and revised classID and oTL.GUID to other
> example provided
> (MS website does not show qoutes on "true" in their examples)
>
> runs but still does not self register or produce typlibrary file
> tried with physical path and without
>
> here is the code:
> -----------------------------------------

> (snip)

Hi

Your WSC file register nicely on my computer, and produces a type library file.

How do you register the WSC file?

If you right-click on it and select "Register", what is the default value under
this registry key:

HKEY_CLASSES_ROOT\scriptletfile\Shell\Register\command


What is the version number on scrobj.dll in your Windows system folder?


As a side note, you should add this one to be able to unregister as well:

Function UnRegister()
End Function

Michael Harris (MVP)

unread,
May 10, 2003, 8:48:07 PM5/10/03
to
> Your WSC file register nicely on my computer, and produces a type
> library file.

Same here - registers as expected with a typlib created...

TJS

unread,
May 10, 2003, 10:02:57 PM5/10/03
to
ok, thanks for testing


Michael Harris (MVP) wrote in message

<#qfVbb1F...@TK2MSFTNGP10.phx.gbl>...

TJS

unread,
May 10, 2003, 10:03:22 PM5/10/03
to
ok, thanks for testing


Torgeir Bakken (MVP) wrote in message <3EBD8712...@hydro.com>...

Torgeir Bakken (MVP)

unread,
May 10, 2003, 10:17:13 PM5/10/03
to
TJS wrote:

> ok, thanks for testing

Hi

Did you make it work for you?

TJS

unread,
May 11, 2003, 2:52:55 AM5/11/03
to
not yet, I will do some retesting

Torgeir Bakken (MVP) wrote in message <3EBDB2A9...@hydro.com>...

Torgeir Bakken (MVP)

unread,
May 11, 2003, 3:50:27 PM5/11/03
to
TJS wrote:

> not yet, I will do some retesting

Hi

If you can't get it to register, here are some question that may help us help
you:

1)


How do you register the WSC file?

2)


If you right-click on it and select "Register", what is the default value under

this registry key:

HKEY_CLASSES_ROOT\scriptletfile\Shell\Register\command

3)
What is the version number on the following files in your Windows system
(System32 on NT4/Win2k/WinXP) folder?

scrobj.dll
wshocm.ocx

0 new messages