Windows Script Host-unidentified error

Took a small example from the documentation for InternetExplorer. Application:

Set IE = CreateObject("InternetExplorer.Application")

IE.Navigate "about:blank"

While IE.Busy
    WScript.Sleep 200
Wend

IE.Visible = 1
IE.Document.Write IE.StatusText
IE.StatusText = "ТЕКСТ СТРОКИ СОСТОЯНИЯ"

When you run the script.vbs script by double-clicking, the IE window appears, and immediately an error occurs:

Строка 10
Символ 1
Ошибка: Неопознанная ошибка
Код: 80004005
Источник: (null)

If you run cscript from cmd - the same thing, running IE and an error in cmd

System: Windows 10

Note, very important: on windows 7 it works, and access to the DOM elements of the page (tested with its html page) is available.

Author: danger9374856, 2021-01-29

1 answers

Apparently, by default, the status bar is missing from the IE window for Windows 10. So you need to turn it on. Before the browser window display line, activate it. And then assign the desired value to the text property.

IE.StatusBar=true
IE.Visible = 1

IE.StatusText = "ТЕКСТ СТРОКИ СОСТОЯНИЯ"

P.S. There was an additional question: why try to output the name of the text of the statusbar to the document?

IE.Document.Write IE.StatusText

P. S. S. Keep in mind that the control object IE may not respond correctly when the VBScript code is processed incorrectly. Accordingly, automation running Internet Explorer will "hang".

 0
Author: Daemon-5, 2021-02-01 10:11:21