Use the vbs script to set the print header and footer information of IE

Source: Internet
Author: User

Save the following content as a. vbs file and double-click it to execute it. On the ie page, right-click the page to check what is added in the menu !! :)

Copy codeThe Code is as follows: 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"

// Create a file first
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 _
+ "// Set the default value of the page header and footer to" + vbcrlf _
+ "Set regwsh = createobject (" wscript. shell "") "+ vbcrlf _
+ "Hkey_key =" "\ pagesetup \ header" + vbcrlf _
+ "Regwsh. regwrite hkey_root + hkey_path + hkey_key," "& w & B page number: & p/& p" + vbcrlf _
+ "Hkey_key =" "\ pagesetup \ footer" + vbcrlf _
+ "Regwsh. regwrite hkey_root + hkey_path + hkey_key," "& u & B & d" + vbcrlf _
+ "// Set the display text on the right-click menu" + vbcrlf _
+ "// First Delete the original item, and then set the new item" + vbcrlf _
+ "On error resume next" + vbcrlf _
+ "Hkey_key = hkey_root + hkey_path +" "\ menuext \ restore the header and footer when printing \" + vbcrlf _
+ "Regwsh. regdelete hkey_key" + vbcrlf _
+ "Hkey_key = hkey_root + hkey_path +" "\ menuext \ remove the header and footer when printing \" + vbcrlf _
+ "Regwsh. regwrite hkey_key, filepath" + vbcrlf _
+ "// Disable 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 _
+ "// Set the blank header and footer for web page printing" + 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 _
+ "// Set the display text on the right-click menu" + vbcrlf _
+ "// First Delete the original item, and then set the new item" + vbcrlf _
+ "On error resume next" + vbcrlf _
+ "Hkey_key = hkey_root + hkey_path +" "\ menuext \ remove the header and footer when printing \" + vbcrlf _
+ "Regwsh. regdelete hkey_key" + vbcrlf _
+ "Hkey_key = hkey_root + hkey_path +" "\ menuext \ restore the header and footer when printing \" + vbcrlf _
+ "Regwsh. regwrite hkey_key, filepath" + vbcrlf _
+ "// Disable regwsh" + vbcrlf _
+ "Set regwsh = nothing" + vbcrlf _
+ "</Script> ")
Fso. close

Set regwsh = wscript. createobject ("wscript. shell ")
Hkey_key = hkey_root + hkey_path + "\ menuext \ remove the header and footer when printing \"
Regwsh. regwrite hkey_key, "c: \ pagesetup_null.htm"

The above information is an integral part of the text. If you want to reprint this article, please keep the above information. Thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.