中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-06 11:06
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 批处理也有GUI LOGO,(调用IE)请高手们来完善它吧 查看 1,050 回复 11
楼 主 批处理也有GUI LOGO,(调用IE)请高手们来完善它吧 发表于 2007-11-03 17:04 ·  中国 浙江 杭州 阿里云
初级用户
★★
积分 172
发帖 63
注册 2007-11-03 10:37
18年会员
UID 101564
性别 男
状态 离线
批处理也有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有目录变量的什么可以加的话,那就太好了。谢谢。
请教高手们来完善它吧。
2 发表于 2007-11-03 22:38 ·  中国 江苏 常州 溧阳市 电信
银牌会员
★★★
积分 2,404
发帖 946
注册 2005-09-08 13:44
20年会员
UID 42345
状态 离线
用about:blank可以替代c:\1.htm
3 发表于 2007-11-03 23:20 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
积分 3,687
发帖 1,467
注册 2005-08-08 12:00
20年会员
UID 44210
状态 离线
about:blank替代c:\1.htm

用下面脚本写入界面
with ie.document
.write "html内容"
end with


参考:IE 界面批处理通讯录
4 发表于 2007-11-04 09:51 ·  中国 浙江 杭州 阿里云
初级用户
★★
积分 172
发帖 63
注册 2007-11-03 10:37
18年会员
UID 101564
性别 男
状态 离线
.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。这样如果换个目录什么的。就得重写。所以很不通用。
5 发表于 2007-11-04 11:28 ·  中国 浙江 丽水 电信
初级用户
积分 20
发帖 9
注册 2007-11-03 22:24
18年会员
UID 101617
性别 男
状态 离线
能否用APP.path获得当前目录啊.在VB中是可以的.
6 发表于 2007-11-04 14:17 ·  中国 陕西 西安 电信
铂金会员
★★★★
积分 5,212
发帖 2,478
注册 2007-02-08 23:39
19年会员
UID 79003
性别 男
状态 离线
支持相对路径吧?

比如打开文件的时候"1.txt"就是指当前文件夹下的……

wscript有个属性是指本身这个脚本的全路径……
7 发表于 2007-11-04 16:09 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
积分 3,687
发帖 1,467
注册 2005-08-08 12:00
20年会员
UID 44210
状态 离线
Wscript.ScriptFullName:表示自身
wscript.arguments(0)=%1
wscript.arguments(1)=%2
wscript.arguments(2)=%3

获取当前目录
Set WshShell = CreateObject("Wscript.Shell")
path = WshShell.CurrentDirectory
8 发表于 2007-11-04 16:28 ·  中国 浙江 杭州 阿里云
初级用户
★★
积分 172
发帖 63
注册 2007-11-03 10:37
18年会员
UID 101564
性别 男
状态 离线
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 ]
9 发表于 2007-11-04 16:32 ·  中国 陕西 西安 电信
铂金会员
★★★★
积分 5,212
发帖 2,478
注册 2007-02-08 23:39
19年会员
UID 79003
性别 男
状态 离线
7楼的代码自己整合
10 发表于 2007-11-04 16:42 ·  中国 浙江 杭州 阿里云
初级用户
★★
积分 172
发帖 63
注册 2007-11-03 10:37
18年会员
UID 101564
性别 男
状态 离线
VBS不太懂啊。请帮帮忙吧。做一个通用的VBS。
即可以这样写。
ielogo.vbs c:\123\123\1.htm 200*100 5
也可以这样写。
ielogo.vbs 1.htm 200*100 5

像一般程序一样操作个文件什么(%1)的一样.谢谢。
11 发表于 2007-11-04 17:57 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
积分 3,687
发帖 1,467
注册 2005-08-08 12:00
20年会员
UID 44210
状态 离线
%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
本帖最近评分记录 (共 1 条) 点击查看详情
评分人分数时间
hello547rf44 +2 2007-11-05 08:11
12 发表于 2007-11-05 08:11 ·  中国 香港 腾讯云
初级用户
★★
积分 172
发帖 63
注册 2007-11-03 10:37
18年会员
UID 101564
性别 男
状态 离线
谢谢解答!!!
论坛跳转: