Board logo

标题: 如何编个VBS让一个同目录的HTM页面无框显示3秒后关闭! [打印本页]

作者: hdshjffdd     时间: 2006-8-8 20:42    标题: 如何编个VBS让一个同目录的HTM页面无框显示3秒后关闭!
如何编个VBS让一个同目录的HTM页面无框显示3秒后关闭!

作者: zh159     时间: 2006-8-9 10:09
set ie=wscript.createobject("internetexplorer.application")
ie.fullscreen=1
ie.width=400
ie.height=300
ie.navigate "完整的网页文件路径"
ie.left=fix((ie.document.parentwindow.screen.availwidth-ie.width)/2)
ie.top=fix((ie.document.parentwindow.screen.availheight-ie.height)/2)
ie.visible=1
wscript.sleep 3000
ie.quit

深入挖掘Windows脚本技术

作者: hdshjffdd     时间: 2006-8-9 17:55
ie.navigate "完整的网页文件路径"
为什么ie.navigate "http://..."不行呢?

作者: 3742668     时间: 2006-8-9 18:21
本地文件应该加file://而不是http://,例如下面的脚本将依次显示当前目录下所有的internet文档,间隔3秒。

'创建IE对象并设置为全屏,可见
Set objIE = CreateObject("InternetExplorer.Application")
objIE.FullScreen = 1
objIE.Visible = 1

'创建文件对象,并遍历当前目录所有类型为HTML Document的文件
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(".")
Set collFiles = objFolder.Files
For Each objFile In collFiles
If objFile.Type = "HTML Document" Then
objIE.Navigate "file://" & objFile.Path
WScript.Sleep 3000
End If
Next
objIE.Quit

作者: IceCrack     时间: 2006-8-9 20:12
真的太强了.学批处理都难啊!又冒出来wsh 没得混了

作者: hdshjffdd     时间: 2006-8-9 21:29
谢谢,xp下可以。98下wscript会报错。经查找,原来是98不支持Script.Sleep 3000这个命令所引起的。可以有无代替的命令?

作者: electronixtar     时间: 2006-8-10 10:03
98下把 WSH 升级到5.6就可以了