How can I test for an open IE window from VBS?

Lenovo / Yoga 3 11"
October 13, 2017 at 06:12:42
Specs: Windows 10, 8 gb
I have a VBS script (in an HTA) that opens another VBS script which opens a webpage in an IE window. Then the first VBS script needs to detect when the IE window has been opened, since there's a short delay from when the first script is opened until the second script has opened the IE window.

I thought this may be possible with some kind of "testfor-loop". In that case, the loop would test for a window with e.g. "Internet Explorer" in the title and certain code would be executed if such a window is found. It would be started right after the first script had launched the second script, but that's irrelevant for now.

It would be great if anyone knew how I can do this, and if possible even include code I can use. Thank you!

See More: How can I test for an open IE window from VBS?

Report •

January 16, 2018 at 03:37:57
try this:

Const TimeToAllowActivationToComplete = 250 ' YMMV so experiment
WshShell.AppActivate "Internet Explorer"
Wscript.Sleep TimeToAllowActivationToComplete
WshShell.SendKeys "^{w}"


i5-6600K@4.670GHz/4.448GHz cache@1.33v | 2x4GB Crucial-DDR4-2133@ 15-15-15-31 2T 2817MHz@1.3v | ASUS Z170-K | Samsung 250GB SSD 850 EVO | MSI RX 570 4GB@1384cc&2087mc bios-powertune-mod | Corsair VS45

Report •
Related Solutions

Ask Question