Hi all
I have follwing VBScript inside my html <head> tag:
-----------------------------------------------------------------------------------------------
<script type="text/vbscript">
// PRINT BUTTON ACTIVATED
Sub PrintMe()
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
//GET SECURITY
MySecurity = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enable")
//GET HEADER and FOOTER INFORMATION
myHeader = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header")
myFooter = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer")
//GET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
size, paper source}
myMargin_Bottom = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom")
myMargin_Top = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top")
myMargin_Left = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left")
myMargin_Right = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right")
// SET SECURITY TO LOW
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enable", "0"
//SET HEADER and FOOTER INFORMATION
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", ""
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", ""
//SET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
size, paper source}
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom", "0.05"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top", "0.5"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left", "0.3"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right", "0.05"
window.print();
// CLEAR THE TEXT BOXES
txt1.value = ""
txt2.value = ""
txt3.value = ""
txt4.value = ""
txt5.value = ""
txt6.value = ""
txt7.value = ""
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enable", "1"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", myHeader
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", myFooter
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom", myMargin_Bottom
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top", myMargin_Top
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left", myMargin_Left
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right", myMargin_Right
End Sub
//CANCEL BUTTON ACTIVATED
Sub ResetHeader()
// CLEAR THE TEXT BOXES
txt1.value = ""
txt2.value = ""
txt3.value = ""
txt4.value = ""
txt5.value = ""
txt6.value = ""
txt7.value = ""
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enable", "1"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", myHeader
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", myFooter
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom", myMargin_Bottom
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top", myMargin_Top
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left", myMargin_Left
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right", myMargin_Right
End Sub
</script>
-----------------------------------------------------------------------------------------------
And in my Rset and Print button has this code:
<input name="Reset" type="reset" id="Reset" value="Reset"
onClick="ResetHeader()">
<input name="Print" type="submit" id="Print" value="Print"
onclick="PrintMe()">
But It doesnot Print nor Reset the html page. In html page I have few
textBoxes and there are no form object.
The error are:
- Type Mismatch PrintMe()
- Type Mismatch ResetHeader()
Does anyone knows how to over come from this problem?
I thank you in advance for your future help.
Rgds,
GC