标题: 批处理也有GUI LOGO,(调用IE)请高手们来完善它吧
[打印本页]
作者: hello547rf44
时间: 2007-11-3 17:04
标题: 批处理也有GUI LOGO,(调用IE)请高手们来完善它吧
批处理也有GUI LOGO,(调用IE)请高手们来完善它吧
》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
set WshShell = Wscript.CreateObject("Wscript.Shell")
set ie=wscript.createobject("internetexplorer.application","event_")
ie.fullscreen=1
ie.width=300
ie.height=100
ie.navigate "c:\1.htm"
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
》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
这段是VBS,是从网上找的。尝试了下。可以用IE来显示本地的网页。样式像logo。它的主要问题是c:\1.htm。一定要是绝对路径。连同目录的也不行。VBS有目录变量的什么可以加的话,那就太好了。谢谢。
请教高手们来完善它吧。
作者: terse
时间: 2007-11-3 22:38
用about:blank可以替代c:\1.htm
作者: zh159
时间: 2007-11-3 23:20
about:blank替代c:\1.htm
用下面脚本写入界面
with ie.document
.write "html内容"
end with
参考:
IE 界面批处理通讯录
作者: hello547rf44
时间: 2007-11-4 09:51
.write "html内容"可以。但是真的好像有点麻烦。要将HTML一句句写进去。而且这个VBS也不通用。我想是不是请高手们来做成这样一个通用的VBS。
ielogo.vbs 参数1(自定义本地网页,如同目录下的1.htm) 参数2(自定义大小边界大小 ,如300*100),参数3(自定义显示秒数,如5。)
然而要编这样一个VBS,首先一个问题就是ie.navigate "c:\1.htm"这句。它只能使用绝对路经。就连%cd%也不能用。这样如果要用的话,就一定要ielogo c:\123\123.htm这样写。而不是ielogo 123.htm。这样如果换个目录什么的。就得重写。所以很不通用。
作者: phai2003
时间: 2007-11-4 11:28
能否用APP.path获得当前目录啊.在VB中是可以的.
作者: slore
时间: 2007-11-4 14:17
支持相对路径吧?
比如打开文件的时候"1.txt"就是指当前文件夹下的……
wscript有个属性是指本身这个脚本的全路径……
作者: zh159
时间: 2007-11-4 16:09
Quote: |
Wscript.ScriptFullName:表示自身
wscript.arguments(0)=%1
wscript.arguments(1)=%2
wscript.arguments(2)=%3 |
|
获取当前目录
Set WshShell = CreateObject("Wscript.Shell")
path = WshShell.CurrentDirectory
作者: hello547rf44
时间: 2007-11-4 16:28
set WshShell = Wscript.CreateObject("Wscript.Shell")
set ie=wscript.createobject("internetexplorer.application","event_")
ie.fullscreen=1
ie.width=300
ie.height=100
ie.navigate wscript.arguments(0)
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
////////////////////////////////////////////////////////////
可是这样还是不行!ie.navigate一定要绝对路径。
想把它做成通用的ielogo.vbs。希望能独立程序一样这样用它.ielogo.vbs 1.htm 200*100 5而不是每次要用还要改VBS里的内容。
但是ie.navigate一定要绝对路径。我想有没有什么方法让它可以读取相对路经。否则换了目录,就得重改%1的路径。
总之,如果这样的话,每次还是要
ielogo.vbs c:\123\123\1.htm 200*100 5
而不是理想中的
ielogo.vbs 1.htm 200*100 5
[
Last edited by hello547rf44 on 2007-11-4 at 04:33 PM ]
作者: slore
时间: 2007-11-4 16:32
7楼的代码自己整合
作者: hello547rf44
时间: 2007-11-4 16:42
VBS不太懂啊。请帮帮忙吧。做一个通用的VBS。
即可以这样写。
ielogo.vbs c:\123\123\1.htm 200*100 5
也可以这样写。
ielogo.vbs 1.htm 200*100 5
像一般程序一样操作个文件什么(%1)的一样.谢谢。
作者: zh159
时间: 2007-11-4 17:57
%1
set WshShell = Wscript.CreateObject("Wscript.Shell")
path = WshShell.CurrentDirectory
set ie=wscript.createobject("internetexplorer.application","event_")
ie.fullscreen=1
ie.width=300
ie.height=100
ie.navigate path & "\" & wscript.arguments(0)
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
直接文件:
set WshShell = Wscript.CreateObject("Wscript.Shell")
path = WshShell.CurrentDirectory
set ie=wscript.createobject("internetexplorer.application","event_")
ie.fullscreen=1
ie.width=300
ie.height=100
ie.navigate path & "\1.htm"
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
作者: hello547rf44
时间: 2007-11-5 08:11
谢谢解答!!!