need help understanding and using wsc files on win64bit

1.2k views Asked by At

I started messing around with making WSC files for my vbscripts but there are a couple of things i don't quite get to work and understand here...

for example, getObject doesn't seem to work:

test.WSC:

<?xml version="1.0"?>
<component>
<registration
description="MyTest"
progid="My.Test"
version="1.00"
classid="{38b3dd76-c4ee-44d0-978e-4ce2d7e14b0f}"
>
</registration>

<public>
<method name="msg">
<PARAMETER name="this"/>
</method>
</public>

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

sub msg(this)
msgbox this
end sub

]]>
</script>
</component>

vbscript(in same folder)

set x = getObject("test.wsc")
x.msg "hello world!"

if i run this i get this error: VBScript Object required: x , code: 800A01A8

also is it possible to cal methods in a "scriptlet.tlb" from vbscript? Any help is welcome :)

1

There are 1 answers

3
Ekkehard.Horner On BEST ANSWER

Without registration, you have to use the script protocol:

set goFS = CreateObject("Scripting.FileSystemObject")
sFSpec = goFS.GetAbsolutePathName(".\test.wsc")
set x = getObject("script:" & sFSpec)
x.msg "hello world!"

study WSC (Windows Script Components) Without Registration!

With registration - keep your

progid="My.Test"

in mind.