您好,登录后才能下订单哦!
本篇内容主要讲解“如何利用vbs脚本实现设置IE的打印页眉页脚信息”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何利用vbs脚本实现设置IE的打印页眉页脚信息”吧!
															将下面的内容保存成.vbs文件,然后双击执行,在打开ie页面,在页面中点击右键,看看菜单中多了个什么!!:) 
    
复制代码 代码如下:
option explicit  
    dim hkey_root,hkey_path,hkey_key,filepath  
    dim fs,fso,regwsh  
    hkey_root="hkey_current_user"  
    hkey_path="\software\microsoft\internet explorer"  
    //先创建文件  
    set fs=wscript.createobject("scripting.filesystemobject")  
    filepath="c:\pagesetup_default.htm"  
    set fso=fs.createtextfile(filepath,true)  
    fso.write("<script language=""vbscript"">"+vbcrlf _  
            +"dim hkey_root,hkey_path,hkey_key,filepath,regwsh" +vbcrlf _  
            +"hkey_root=""hkey_current_user""" +vbcrlf _  
            +"hkey_path=""\software\microsoft\internet explorer""" +vbcrlf _  
            +"filepath=""c:\pagesetup_null.htm""" +vbcrlf _  
            +"//设置网页打印的页眉页脚为默认值"+vbcrlf  _  
            +"set regwsh = createobject(""wscript.shell"")" +vbcrlf _  
            +"hkey_key=""\pagesetup\header""" +vbcrlf _  
            +"regwsh.regwrite hkey_root+hkey_path+hkey_key,""&w&b页码:&p/&p""" +vbcrlf _  
            +"hkey_key=""\pagesetup\footer""" +vbcrlf _  
            +"regwsh.regwrite hkey_root+hkey_path+hkey_key,""&u&b&d""" +vbcrlf _  
            +"//设置右键菜单上的显示文字" +vbcrlf _  
            +"//首先删除原来的项,然后再设置新的项"+vbcrlf  _  
            +"on error resume next" +vbcrlf _  
            +"hkey_key=hkey_root+hkey_path+""\menuext\打印时恢复页眉页脚\""" +vbcrlf _  
            +"regwsh.regdelete hkey_key" +vbcrlf _  
            +"hkey_key=hkey_root+hkey_path+""\menuext\打印时去掉页眉页脚\""" +vbcrlf _  
            +"regwsh.regwrite hkey_key,filepath" +vbcrlf _  
            +"//关闭regwsh" +vbcrlf _  
            +"set regwsh=nothing"+vbcrlf  _  
        +"</script>")  
    fso.close  
    filepath="c:\pagesetup_null.htm"  
    set fso=fs.createtextfile(filepath,true)  
    fso.write("<script language=""vbscript"">" +vbcrlf _  
            +"dim hkey_root,hkey_path,hkey_key,filepath,regwsh" +vbcrlf _  
            +"hkey_root=""hkey_current_user""" +vbcrlf _  
            +"hkey_path=""\software\microsoft\internet explorer""" +vbcrlf _  
            +"filepath=""c:\pagesetup_default.htm""" +vbcrlf _  
            +"//设置网页打印的页眉页脚为空" +vbcrlf _  
            +"set regwsh =createobject(""wscript.shell"")" +vbcrlf _  
            +"hkey_key=""\pagesetup\header""" +vbcrlf _  
            +"regwsh.regwrite hkey_root+hkey_path+hkey_key,""""" +vbcrlf _  
            +"hkey_key=""\pagesetup\footer""" +vbcrlf _  
            +"regwsh.regwrite hkey_root+hkey_path+hkey_key,""""" +vbcrlf _  
            +"//设置右键菜单上的显示文字" +vbcrlf _  
            +"//首先删除原来的项,然后再设置新的项" +vbcrlf _  
            +"on error resume next"+vbcrlf  _  
            +"hkey_key=hkey_root+hkey_path+""\menuext\打印时去掉页眉页脚\""" +vbcrlf _  
            +"regwsh.regdelete hkey_key"+vbcrlf  _  
            +"hkey_key=hkey_root+hkey_path+""\menuext\打印时恢复页眉页脚\""" +vbcrlf _  
            +"regwsh.regwrite hkey_key,filepath" +vbcrlf _  
            +"//关闭regwsh" +vbcrlf _  
            +"set regwsh=nothing"+vbcrlf  _  
        +"</script>")  
    fso.close  
    set regwsh=wscript.createobject("wscript.shell")  
    hkey_key=hkey_root+hkey_path+"\menuext\打印时去掉页眉页脚\"  
    regwsh.regwrite hkey_key,"c:\pagesetup_null.htm" 
到此,相信大家对“如何利用vbs脚本实现设置IE的打印页眉页脚信息”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。