【发布时间】:2015-01-20 02:19:58
【问题描述】:
好的,我在这里做错了什么? 我正在尝试以这种方式包含一个带有类的 vbscript:
SCRIPT.VBS:
set inc = createobject("script.runner")
inc.Include "class"
set x = new test
x.msg' here i get the error 'undefined class'!
注册的 .wsc 文件:
<?xml version="1.0"?>
<component>
<registration
description="wsc"
progid="script.runner"
version="1.00"
classid="{f65e154c-43b3-4f8f-aa3d-535af68f51d1}"
>
</registration>
<public>
<method name="Include">
<PARAMETER name="Script"/>
</method>
</public>
<script language="VBScript">
<![CDATA[
Sub Include(Script)
ExecuteGlobal(CreateObject("scripting.filesystemobject").OpenTextFile(Script & ".vbs", 1).Readall & VBNewLine)
End Sub
]]>
</script>
</component>
CLASS.VBS:
class test
public sub msg
msgbox "hi"
end sub
end class
我在想,如果我要使用类或其他东西,我可能需要在 wsc 文件中定义它吗? 我不知道。。
感谢您的帮助!
【问题讨论】:
标签: vbscript com include createobject wsc