我开始为我的vbscript做WSC文件,但是有几件事我不太明白。
例如,getObject似乎不起作用:
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(在同一文件夹中)
set x = getObject("test.wsc")
x.msg "hello world!"如果运行此操作,将得到以下错误: VBScript对象必需:x,代码: 800A01A8
在vbscript的"scriptlet.tlb“中也可以用cal方法吗?欢迎任何帮助:)
发布于 2014-11-16 21:08:46
如果没有注册,您必须使用脚本协议:
set goFS = CreateObject("Scripting.FileSystemObject")
sFSpec = goFS.GetAbsolutePathName(".\test.wsc")
set x = getObject("script:" & sFSpec)
x.msg "hello world!"研究WSC (Windows脚本组件)无需注册!
通过注册-保存你的
progid="My.Test"记在心里。
https://stackoverflow.com/questions/26960090
复制相似问题