手机
当前位置:查字典教程网 >脚本专栏 >vbs >利用vbs脚本实现设置IE的打印页眉页脚信息
利用vbs脚本实现设置IE的打印页眉页脚信息
摘要:将下面的内容保存成.vbs文件,然后双击执行,在打开ie页面,在页面中点击右键,看看菜单中多了个什么!!:)复制代码代码如下:optione...

将下面的内容保存成.vbs文件,然后双击执行,在打开ie页面,在页面中点击右键,看看菜单中多了个什么!!:)

复制代码 代码如下:

optionexplicit

dimhkey_root,hkey_path,hkey_key,filepath

dimfs,fso,regwsh

hkey_root="hkey_current_user"

hkey_path="softwaremicrosoftinternetexplorer"

//先创建文件

setfs=wscript.createobject("scripting.filesystemobject")

filepath="c:pagesetup_default.htm"

setfso=fs.createtextfile(filepath,true)

fso.write("<scriptlanguage=""vbscript"">"+vbcrlf_

+"dimhkey_root,hkey_path,hkey_key,filepath,regwsh"+vbcrlf_

+"hkey_root=""hkey_current_user"""+vbcrlf_

+"hkey_path=""softwaremicrosoftinternetexplorer"""+vbcrlf_

+"filepath=""c:pagesetup_null.htm"""+vbcrlf_

+"//设置网页打印的页眉页脚为默认值"+vbcrlf_

+"setregwsh=createobject(""wscript.shell"")"+vbcrlf_

+"hkey_key=""pagesetupheader"""+vbcrlf_

+"regwsh.regwritehkey_root+hkey_path+hkey_key,""&w&b页码:&p/&p"""+vbcrlf_

+"hkey_key=""pagesetupfooter"""+vbcrlf_

+"regwsh.regwritehkey_root+hkey_path+hkey_key,""&u&b&d"""+vbcrlf_

+"//设置右键菜单上的显示文字"+vbcrlf_

+"//首先删除原来的项,然后再设置新的项"+vbcrlf_

+"onerrorresumenext"+vbcrlf_

+"hkey_key=hkey_root+hkey_path+""menuext打印时恢复页眉页脚"""+vbcrlf_

+"regwsh.regdeletehkey_key"+vbcrlf_

+"hkey_key=hkey_root+hkey_path+""menuext打印时去掉页眉页脚"""+vbcrlf_

+"regwsh.regwritehkey_key,filepath"+vbcrlf_

+"//关闭regwsh"+vbcrlf_

+"setregwsh=nothing"+vbcrlf_

+"</script>")

fso.close

filepath="c:pagesetup_null.htm"

setfso=fs.createtextfile(filepath,true)

fso.write("<scriptlanguage=""vbscript"">"+vbcrlf_

+"dimhkey_root,hkey_path,hkey_key,filepath,regwsh"+vbcrlf_

+"hkey_root=""hkey_current_user"""+vbcrlf_

+"hkey_path=""softwaremicrosoftinternetexplorer"""+vbcrlf_

+"filepath=""c:pagesetup_default.htm"""+vbcrlf_

+"//设置网页打印的页眉页脚为空"+vbcrlf_

+"setregwsh=createobject(""wscript.shell"")"+vbcrlf_

+"hkey_key=""pagesetupheader"""+vbcrlf_

+"regwsh.regwritehkey_root+hkey_path+hkey_key,"""""+vbcrlf_

+"hkey_key=""pagesetupfooter"""+vbcrlf_

+"regwsh.regwritehkey_root+hkey_path+hkey_key,"""""+vbcrlf_

+"//设置右键菜单上的显示文字"+vbcrlf_

+"//首先删除原来的项,然后再设置新的项"+vbcrlf_

+"onerrorresumenext"+vbcrlf_

+"hkey_key=hkey_root+hkey_path+""menuext打印时去掉页眉页脚"""+vbcrlf_

+"regwsh.regdeletehkey_key"+vbcrlf_

+"hkey_key=hkey_root+hkey_path+""menuext打印时恢复页眉页脚"""+vbcrlf_

+"regwsh.regwritehkey_key,filepath"+vbcrlf_

+"//关闭regwsh"+vbcrlf_

+"setregwsh=nothing"+vbcrlf_

+"</script>")

fso.close

setregwsh=wscript.createobject("wscript.shell")

hkey_key=hkey_root+hkey_path+"menuext打印时去掉页眉页脚"

regwsh.regwritehkey_key,"c:pagesetup_null.htm"

以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

【利用vbs脚本实现设置IE的打印页眉页脚信息】相关文章:

用vbs实现禁用服务

用vbs实现按创建日期的顺序列出一个文件夹中的所有文件

VBS常用脚本 好东西

用vbscript合并多个文本文件的代码

用vbs列出机器上所有能调用的组件

用vbscript实现修改屏幕保护的等待时间长度

一个用vbs查找硬盘所有分区中的指定程序的代码

用VBS精确计算2的100次方的代码

用vbs实现配置静态 IP 地址

用vbs检查注册表项的访问权限的代码

精品推荐
分类导航