VBS中inlcude另一个vbs脚本的方法
来源:互联网 发布:js设置控件隐藏 编辑:程序博客网 时间:2024/05/16 18:12
VBS中inlcude另一个vbs脚本的方法
54powerman
' Test program for the IncludeFile and ReadConfigFile functions.
' Author: Christian d'Heureuse (www.source-code.biz)
' License: GNU/LGPL (http://www.gnu.org/licenses/lgpl.html)
Option Explicit
Dim fso: set fso = CreateObject("Scripting.FileSystemObject")
' Includes a file in the global namespace of the current script.
' The file can contain any VBScript source code.
' The path of the file name must be specified relative to the
' directory of the main script file.
Private Sub IncludeFile (ByVal RelativeFileName)
Dim ScriptDir: ScriptDir = fso.GetParentFolderName(WScript.ScriptFullName)
Dim FileName: FileName = fso.BuildPath(ScriptDir,RelativeFileName)
IncludeFileAbs FileName
End Sub
' Includes a file in the global namespace of the current script.
' The file can contain any VBScript source code.
' The path of the file name must be specified absolute (or
' relative to the current directory).
Private Sub IncludeFileAbs (ByVal FileName)
Const ForReading = 1
Dim f: set f = fso.OpenTextFile(FileName,ForReading)
Dim s: s = f.ReadAll()
ExecuteGlobal s
End Sub
IncludeFile "MyClass.vbs"
Dim test
Set test = new MyClass
test.MyFunc
VBS中inlcude另一个vbs脚本的方法
54powerman
' Test program for the IncludeFile and ReadConfigFile functions.
' Author: Christian d'Heureuse (www.source-code.biz)
' License: GNU/LGPL (http://www.gnu.org/licenses/lgpl.html)
Option Explicit
Dim fso: set fso = CreateObject("Scripting.FileSystemObject")
' Includes a file in the global namespace of the current script.
' The file can contain any VBScript source code.
' The path of the file name must be specified relative to the
' directory of the main script file.
Private Sub IncludeFile (ByVal RelativeFileName)
Dim ScriptDir: ScriptDir = fso.GetParentFolderName(WScript.ScriptFullName)
Dim FileName: FileName = fso.BuildPath(ScriptDir,RelativeFileName)
IncludeFileAbs FileName
End Sub
' Includes a file in the global namespace of the current script.
' The file can contain any VBScript source code.
' The path of the file name must be specified absolute (or
' relative to the current directory).
Private Sub IncludeFileAbs (ByVal FileName)
Const ForReading = 1
Dim f: set f = fso.OpenTextFile(FileName,ForReading)
Dim s: s = f.ReadAll()
ExecuteGlobal s
End Sub
IncludeFile "MyClass.vbs"
Dim test
Set test = new MyClass
test.MyFunc
MyClass.vbs代码
Class MyClass
Public Function MyFunc
MsgBox "测试VBS调用VBS类"
End Function
End Class
- VBS中inlcude另一个vbs脚本的方法
- vbs脚本中引用dll的方法
- QTP中连接数据库的vbs脚本
- 好玩的脚本.VBS
- securecrt的vbs脚本
- VBS脚本
- vbs脚本
- vbs脚本
- Vbs脚本
- vbs脚本
- vbs的Run方法
- [编程实例]vbs脚本移动桌面上的m.vbs d.vbs到d盘特定目录中
- 一些经典的vbs脚本
- 一些经典的vbs脚本
- 编码转换的vbs脚本
- 图片尺寸转换的VBS脚本
- 安装OA的VBS脚本
- vbs脚本:文件操作.vbs
- 终端服务器超出了最大允许连接数怎么办?
- 10倍速影像阅读法
- 全球最贵的13样东西(图)
- 不吃Papa Pizza--棒约翰
- 收集一些有关SilverLight(WPF/E)的链接[转贴]
- VBS中inlcude另一个vbs脚本的方法
- 巴菲特打造全球最贵股票
- How To: 获取本机固定IP
- MyEclipse开发JSF实例
- 说说刘德华
- 第四讲:DataAdapter深入
- 六招关闭自动播放
- 病毒 Virus.Win32.Autorun修改系统时间
- 用多线程编程