vkokkodan posted this 24 April 2015
I was trying to install the scriptX for silent printing in our application. We had a silet printing using vbscript,
Sub Print()
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1
call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
End Sub
but once IE11 came in, it is not working. We made that working using a java script, but needed to make a ActiveX setting change (Initialize and script ActiveX controls not marked as safe for scripting - Enabled)
function printJS(){
if (navigator.appName == "Microsoft Internet Explorer"){
var PrintCommand = '<object ID="PrintCommandObject" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
PrintCommandObject.ExecWB(6, 2); PrintCommandObject.outerHTML = "";
} else { window.print();}
}
As the customers do not want this solution, we need to search for some other method to do the silent print. Either using a Java Applet or other 3rd party tool. below code do not create a 'factory' object for me.
<!-- MeadCo ScriptX -->
<object id="factory" style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
codebase="https://localhost:9444/SelfServiceWeb/WEB-INF/smsx.cab#Version=7,5,0,20">
</object>
<script type="text/javascript" >
function window.onload() {
if ( !factory.object ) {
alert("MeadCo's ScriptX Control is not properly installed!");
//navigate("scriptx-install-error.htm");
return;
}
alert("Ready to script MeadCo's ScriptX!")
}
</script>
While running, I'm getting factory as a OBJECT, but getting the message as 'MeadCo's ScriptX Control is not properly installed!'. I'm using IE8. I do not have any other objects in
the file. Can anyone help?