Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1833
  • Last Modified:

VBScript - Find IE window

I was wondering if anyone knew how to find if a certain IE window is open (by it's window title) using VBScript.

I'm looking for the VBScript equivalent of this this VB.net code:

Dim IE() as Process
Dim n as Integer
Dim bOpen As Boolean = False
IE = Process.GetProcessesByName("IEXPLORE")
If IE.Length > 0 Then
    For n = 0 to IE.Length - 1
        If IE(n).MainWindowTitle.StartsWith("Website A") Then
            MsgBox("Website A is open")
            Exit For
        End If
    Next
End If

THANKS!!!
0
CaitlinRoberts
Asked:
CaitlinRoberts
1 Solution
 
AzraSoundCommented:
Dim shWin
Dim i

Set shWin = CreateObject("Shell.Application")
For i = 0 To shWin.windows.count - 1
    If Left(shWin.windows(i).LocationName, 9) = "Website A" Then
        MsgBox "Website A is open"
        Exit For
    End If
Next
0
 
CaitlinRobertsAuthor Commented:
Perfect!  Thanks AzraSound!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now