Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

Automate print settings in IE9 using ActiveX not working as expected

$
0
0

Hi

I am trying to set the printing options in PageSetup using ActiveX and WScript.Shell

My requirements is that on click on a HTML button, some of the options in Page Setup have to be set and then the user has to be shown the Print dialog where he can select the printer.

I am using the below script to achieve this

functionSetPagePrintOptions(pageDim){try{
  shell =newActiveXObject("WScript.Shell");
  shell.sendKeys('%fu');//brings up page setup
  shell.SendKeys('{TAB}a');//sets orientation to Landscape
  shell.SendKeys('{ENTER}');
  window.setTimeout("shell.SendKeys('%fp')",1000);// brings up print dialog}catch(e){
  alert(e.Discription);}}

The problem is that the script is working fine in IE8 but its not working as expected in IE9.

The script works fine until the point where it sets the orientation to Landscape but it does not show the Print dialog to select the printer until the user clicks onOK in the Page Setup dialog.

If i change the last line in the script and rewrite it as shell.SendKeys('%fp')it still works fine with IE8 but again does not work as expected in IE9.

It sets the options in Page Setup, the dialog disappears and then the Print dialog does not appear after this.

Please help me out.


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>