Using Edge for VB Script (VBS) output

Robert Bruce 1 Reputation point
2022-07-11T12:24:54.69+00:00

I use the following code to display output from running VBS scripts, currently it uses Internet Explorer but with the demise of IE needs to be converted to use Edge.

Function IEinit()   
    Set objExplorer = Wscript.createobject("InternetExplorer.Application")  
    objexplorer.navigate "about:blank"   
    objExplorer.ToolBar = 0   
    objExplorer.StatusBar = 0   
    objExplorer.Visible = 1   
    objExplorer.Document.Title = "Script Status"   
End Function  

Function DisplayMSG(Output)   
   If output="" then   
      Exit Function   
   Else   
      Displaydata=DisplayData & Output   
         do while objExplorer.busy = True   
      loop   
      objExplorer.Document.Body.InnerHTML = Displaydata   
      objExplorer.document.parentwindow.scrollto 0,(objExplorer.document.Body.scrollheight)   
   end If   
End Function  

This needs to use only native windows components that are installed with the OS.

The script calls IEinit once at the beginning and uses a call to DisplayMSG with the HTML to display when required.

Any assistance would be appreciated.

Robert

Microsoft Edge Microsoft Edge development
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2022-07-11T13:13:05.54+00:00

    of IE needs to be converted to use Edge.

    You simply can not.
    Internet Explorer provides a ActiveX (COM) interface, which you use in VBS.
    Edge don't provide such.,

    0 comments No comments

  2. Anonymous
    2022-07-12T02:49:13.117+00:00

    Hi @Robert Bruce ,

    As informed by the other community member, you will not be able to automate the Edge browser like you automate the IE browser using the VBScript.

    You said, 'I use the following code to display output from running VBS scripts, currently it uses Internet Explorer but with the demise of IE needs to be converted to use Edge.'

    I would like to inform you that your VBScript will continue to work even after the IE browser retirement. So you do not need to convert your code to make it work with the Edge browser.

    As part of the IE 11 application retirement, certain COM automation scenarios were inadvertently broken. These IE COM objects have been restored to their original functionality as of the Windows 11 November 2021 “C” update and the Windows 10 February 2022 “B” update (for versions 1809 and later). The COM scenarios will also continue to work after the IE11 desktop application is disabled after June 15, 2022. If you continue to experience issues after taking the update, please contact App Assure for remediation assistance.

    Reference: Internet Explorer 11 desktop app retirement FAQ

    Best Regards,
    Deepak

    ----------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Delli gatti, Joseph 1 Reputation point
    2022-07-19T23:03:37.92+00:00

    Deepak,

    Will this also work again after the update?

            Set ie = CreateObject("InternetExplorer.Application")  
            ie.navigate URLAll  
        While ie.ReadyState <> 4  
            DoEvents  
        Wend  
      
    Set ieDoc = ie.document  
    ReturnData = ieDoc.activeElement.innerText  
    iCnt = Len(ReturnData)  
    

  4. Delli gatti, Joseph 1 Reputation point
    2022-07-20T15:36:14.29+00:00

    Interesting. I had a new copy of Microsoft Office installed on my new laptop I recently received. I have an add-in that I created that implements the above code. The add-in works on the older laptop, and not the new one. So, hopefully, as soon as Office updates on my laptop to the current version, I'll be able to run it without issue. If it doesn't work after the update, I'll post on a new thread.

    Thank you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.