Link to home
Start Free TrialLog in
Avatar of TrialUser
TrialUserFlag for Afghanistan

asked on

convert javascript to vbscript code

I have a function in javascript. Does the following:
1) Print the webpage
2) toggle visibility for a couple of table elements
3) print another copy
4) trigger a button click (so I can execute soem code in the code behind VB.NET

I needed a silen print (print from IE9 without print prompt for printer selection)

So I replaced step 1 with the following vbscript. Now I need help to convert the steps 2,3,4 from javascript to vbscript.. Please help. Thanks.

VBscript:
<script language='VBScript' type="text/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>

Javascript:

<script type="text/javascript">
    function Print() {
       window.print();
       

       var tblStore = document.getElementById("<%= tblDash.ClientID %>");
       tblStore.style.display = 'none';

       var tblCustomer = document.getElementById("<%= tblCustomerCopy.ClientID %>");
       tblCustomer.style.display = 'block';
       window.print();

       var clickButton = document.getElementById("<%= lnkHome.ClientID %>");
        clickButton.click();
    }
    </script>
ASKER CERTIFIED SOLUTION
Avatar of Jon Norman
Jon Norman
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TrialUser

ASKER

awesome, exactly what i wanted. Thanks a bunch