- 帖子
- 431
- 积分
- 1577
- 技术
- 11
- 捐助
- 0
- 注册时间
- 2013-1-11
|
本帖最后由 我来了 于 2013-4-15 22:08 编辑
完整 的代码是这样的:randomize
set fso = CreateObject("Scripting.Filesystemobject")
set a = CreateObject("Scripting.Dictionary")
set file = fso.OpenTextFile("C:\Documents and Settings\Administrator\桌面\3.txt")
do while file.AtendofStream<>true
m = m + 1
a.add m,file.readline
loop
file.close
h=int(rnd * m)
WshShell.run "G:\PowerPro_4.9n7\配置文件夹\nircmd.exe clipboard set " & chr(34) & a(h) & chr(34)
这样写会报错的。
脚本 : C:\Documents and Settings\Administrator\桌面\新建 文本.vbs
行: 13
字符: 2
错误: 缺少对象: 'WshShell'
代码: 800A01A8
源: Microsoft VBScript 运行时错误
对VBS压根不入流,我猜测可能前面少了定义
以 WshShell google搜索,专门找运行之类的东西,结果换成下面的,就OK了。
必须搞成这样:
randomize
set fso = CreateObject("Scripting.Filesystemobject")
set a = CreateObject("Scripting.Dictionary")
set file = fso.OpenTextFile("C:\Documents and Settings\Administrator\桌面\3.txt")
do while file.AtendofStream<>true
m = m + 1
a.add m,file.readline
loop
file.close
h=int(rnd * m)
CreateObject("WScript.Shell").Run "G:\PowerPro_4.9n7\配置文件夹\nircmd.exe clipboard set " & chr(34) & a(h) & chr(34) |
|