利用vbs腳本實現(xiàn)設(shè)置IE的打印頁眉頁腳信息
來源:本站原創(chuàng)|時間:2020-01-10|欄目:vb|點擊: 次
將下面的內(nèi)容保存成.vbs文件,然后雙擊執(zhí)行,在打開ie頁面,在頁面中點擊右鍵,看看菜單中多了個什么!?。海?nbsp;
復制代碼 代碼如下:
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"
//先創(chuàng)建文件
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 _
+"http://設(shè)置網(wǎng)頁打印的頁眉頁腳為默認值"+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 _
+"http://設(shè)置右鍵菜單上的顯示文字" +vbcrlf _
+"http://首先刪除原來的項,然后再設(shè)置新的項"+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 _
+"http://關(guān)閉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 _
+"http://設(shè)置網(wǎng)頁打印的頁眉頁腳為空" +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 _
+"http://設(shè)置右鍵菜單上的顯示文字" +vbcrlf _
+"http://首先刪除原來的項,然后再設(shè)置新的項" +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 _
+"http://關(guān)閉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"
以上信息與文章正文是不可分割的一部分,如果您要轉(zhuǎn)載本文章,請保留以上信息,謝謝!
您可能感興趣的文章
- 01-10下載文件到本地運行的vbs
- 01-10VBS中的正則表達式的用法大全 <font color=red>原創(chuàng)&
- 01-10VBS中SendKeys的基本應(yīng)用
- 01-10VBScript教程 第十一課深入VBScript
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript語法速查及實例說明
- 01-10VBS中Select CASE的其它用法
- 01-10VBScript教程 第七課使用條件語句
- 01-10vbscript 可以按引用傳遞參數(shù)嗎?
- 01-10VBScript教程 第二課在HTML頁面中添加VBscript代碼


閱讀排行
本欄相關(guān)
- 01-10下載文件到本地運行的vbs
- 01-10飄葉千夫指源代碼,又稱qq刷屏器
- 01-10SendKeys參考文檔
- 01-10什么是一個高效的軟件
- 01-10VBS中的正則表達式的用法大全 &l
- 01-10exe2swf 工具(Adodb.Stream版)
- 01-10VBS中SendKeys的基本應(yīng)用
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript教程 第十一課深入VBScript
- 01-10VBScript語法速查及實例說明
隨機閱讀
- 08-05織夢dedecms什么時候用欄目交叉功能?
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 08-05dedecms(織夢)副欄目數(shù)量限制代碼修改
- 01-10使用C語言求解撲克牌的順子及n個骰子
- 01-11ajax實現(xiàn)頁面的局部加載
- 08-05DEDE織夢data目錄下的sessions文件夾有什
- 01-10delphi制作wav文件的方法
- 01-10C#中split用法實例總結(jié)
- 04-02jquery與jsp,用jquery