0

I am trying to click a Print button using vbscript. However, it doesn't actually fire the appropriate events. So now I think I need to figure out a way to call the function itself.

Here is the button code:

<input name="ucDetailsAJ1670783$btnPrint" tabindex="-1" class="rbDecorated rbPrimary" id="ucDetailsAJ1670783_btnPrint_input" style="width: 100%; padding-right: 4px; padding-left: 0px;" type="submit" value="Print">

<input name="ucDetailsAJ1670783_btnPrint_ClientState" id="ucDetailsAJ1670783_btnPrint_ClientState" type="hidden" value='{"text":"Print","value":"","checked":false,"target":"","navigateUrl":"","commandName":"","commandArgument":"","autoPostBack":false,"selectedToggleStateIndex":0,"validationGroup":null,"readOnly":false,"primary":false,"enabled":true}' autocomplete="off">

Here is the print function code:

function btnPrint_OnClientClicking(sender, args)
{

        doPrint();


    return false;
}

function openPopup()
{
    var url = document.location.origin + '/Customized/CustomizedControls/DEAModules/Search/PrintDetails.aspx?RelId=605598&Key=29_117_8_167_19_163_12_121_129_12_163_128_60_154_31_198_70_205_6_230_173_133_82_216_52_56_178_209_108_67_255_205';
        var win = window.open(url, '_blank');
        if (win) win.focus();
}

function doPrint()
{
        var divButtons = document.getElementById('ucDetailsAJ1670783_divButtons');  
        if (divButtons) { divButtons.style.display = 'none'; }

        setTimeout("window.print();", 300);

}

Here is my code & the error messages I receive(using vbscript to call a javascript function) I know I am missing something:

Null error message

objIE.Document.parentWindow.execScript "doPrint();", "javascript"

Expected statement

objIE.Document.parentWindow.execScript "doPrint();", "jscript"

Unterminated string constant

objIE.document.parentWindow.execScript "btnPrint_OnClientClicking(sender, args);", "javascript"

Expected statement

objIE.document.parentWindow.execScript "btnPrint_OnClientClicking();", "javascript"

1 Answer 1

1

You may have fallen foul of changes in Internet Explorer 11

From MSHTML Reference - execScript method

[IHTMLWindow2::execScript is no longer supported. Starting with Internet Explorer 11, use eval. For info, see Compatibility changes.]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.