Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Usage: IeWebCheck [/i] {title}
- '
- '/i Ignore case.
- '
- '"*" and "?" wildcards can be used.
- '
- 'Exit codes: 0 = Not found, 1 = Found
- if wscript.arguments.count = 0 then
- wscript.echo "Usage: IeWebCheck [/i] {title}" & _
- vbcrlf & vbcrlf & "/i Ignore case." & _
- vbcrlf & vbcrlf & """*"" and ""?"" wildcards can be used." & _
- vbcrlf & vbcrlf & "Exit codes: 0 = Not found, 1 = Found"
- wscript.quit
- end if
- set rx = new regexp
- rx.ignorecase = wscript.arguments.named.exists("I")
- s = wscript.arguments.unnamed(0)
- s2 = ""
- for i = 1 to len(s)
- c = mid(s, i, 1)
- select case c
- case "*"
- s2 = s2 & ".*?"
- case "?"
- s2 = s2 & "."
- case "$", "(", ")", "+", ".", "[", "\", "]", "^", "{", "|", "}"
- s2 = s2 & "\" & c
- case else
- s2 = s2 & c
- end select
- next
- rx.pattern = "^" & s2 & "$"
- set sa = createobject("shell.application")
- found = 0
- for each wnd in sa.windows
- if wnd.name = "Internet Explorer" then
- if rx.test(wnd.document.title) then
- found = 1
- exit for
- end if
- end if
- next
- wscript.quit found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement