利用vbs腳本實現(xiàn)設(shè)置IE的打印頁眉頁腳信息
更新時間:2007年02月26日 00:00:00 作者:
這篇文章主要為大家分享下通過vbs腳本實現(xiàn)設(shè)置IE的打印頁眉頁腳信息的代碼,需要的朋友可以參考下
將下面的內(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)頁打印的頁眉頁腳為默認(rèn)值"+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\打印時恢復(fù)頁眉頁腳\""" +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\打印時恢復(fù)頁眉頁腳\""" +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)載本文章,請保留以上信息,謝謝!
復(fù)制代碼 代碼如下:
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)頁打印的頁眉頁腳為默認(rèn)值"+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\打印時恢復(fù)頁眉頁腳\""" +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\打印時恢復(fù)頁眉頁腳\""" +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)載本文章,請保留以上信息,謝謝!
相關(guān)文章
WScript.Shell對象SpecialFolders屬性未公開文檔分享
WshShell對象的SpecialFolders屬性返WshSpecialFolders 對象,該對象是一個特殊文件夾集合,其中包含整套Windows特殊文件夾2013-01-01VBS基礎(chǔ)篇 - 循環(huán)(for、Do、While)
經(jīng)常地,當(dāng)編寫代碼時,我們希望將一段代碼執(zhí)行若干次,我們可以在代碼中使用循環(huán)語句來完成這項工作,需要的朋友可以參考下2018-05-05用vbs實現(xiàn)的簡單的服務(wù)器文件備份辦法壓縮文件名自動按日期命名
2007-12-12用VBS模擬實現(xiàn)PHP的sha1_file函數(shù)效果代碼
用VBS模擬實現(xiàn)PHP的sha1_file函數(shù)效果代碼,需要的朋友可以參考下。2011-01-01VBS調(diào)用WMI實現(xiàn)搜索硬盤mp3文件
如果你想用遞歸搜索我也沒辦法。下面的程序搜索電腦上所有的MP3文件。2011-01-01