Print without prompting
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Print without prompting
Hi there, is there any possibility to make this vbscript acceptable in hta? It is currently workin in IE but not HTA.<script language='VBScript'> Sub Print() OLECMDID_PRINT = 6 OLECMDEXECOPT_DONTPROMPTUSER = 2 OLECMDEXECOPT_PROMPTUSER = 1 call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1) End Sub document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>" </script>
Print without prompting
Hi there, is there any possibility to make this vbscript acceptable in hta? It is currently workin in IE but not HTA.<script language='VBScript'> Sub Print() OLECMDID_PRINT = 6 OLECMDEXECOPT_DONTPROMPTUSER = 2 OLECMDEXECOPT_PROMPTUSER = 1 call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1) End Sub document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>" </script>
Print without prompting
Put the following in a file with an hta EXTENSION.
jvierra2010-08-19 23:37:31
Code: Select all
<input type="button" value="Print Me" onclick='print()'/>
When all good men come to the aid of their party ... and party dood!
When all good men come to the aid of their party ... and party dood!
Print without prompting
YOu cannot do that.
I posted code for you to test. Just put it in an HTA with nothing wlse to see how it works.
YOu are, for some unknown reason, trying to add you old non-functionaly code to the correct code posted.
This goes in a file with an HTA extension
Nothing else. Just those two lines.
I posted code for you to test. Just put it in an HTA with nothing wlse to see how it works.
YOu are, for some unknown reason, trying to add you old non-functionaly code to the correct code posted.
This goes in a file with an HTA extension
Code: Select all
<input type="button" value="Print Me" onclick='print()'/>
Hello World will print now!
Nothing else. Just those two lines.
Print without prompting
Here is the documentation for the 'print' method of WIndows.
http://msdn.microsoft.com/en-us/library ... S.85).aspx
The object you are trying to use will not work in IE or in an HTA. The object has been disabled for security reasons.
The code I posted is the minimum code needed to demonstrate the function.
Note that ny file, even an empty file will run as an hta if you give it an HTA extension.
Try creating an empty HTA file and running it. Use the "View Source" menu item to look at teh file. You will be surprised by what seems to be in a file that is empty.
This can be usefule if you forget the structure of an HTML file as you can copy and paste this and it will have been created by WIndows. Sort of auto file generation.
COntents of an empty file.
This is because the browser is required by HTML rules to provide default base items for a page.
http://msdn.microsoft.com/en-us/library ... S.85).aspx
The object you are trying to use will not work in IE or in an HTA. The object has been disabled for security reasons.
The code I posted is the minimum code needed to demonstrate the function.
Note that ny file, even an empty file will run as an hta if you give it an HTA extension.
Try creating an empty HTA file and running it. Use the "View Source" menu item to look at teh file. You will be surprised by what seems to be in a file that is empty.
This can be usefule if you forget the structure of an HTML file as you can copy and paste this and it will have been created by WIndows. Sort of auto file generation.
COntents of an empty file.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>
This is because the browser is required by HTML rules to provide default base items for a page.