We have created a VBScript that monitors when they are attached to the
system and when that EXE is closed will close all of the open IE
windows.
Because of the way these devices are used, we don't want them opening
IE windows except when they are attached to that particular system and
our script work beautifully in that respect.
BUT - There is also another IE window that is normally open on the
device that is locked to a specific site/url that we don't care if
they are attached to the other system when they are using.
How do I NOT kill that particular IE window? I think that testing for
the window title - which does not change or the site url/ipaddress
would be best but I am at a loss on how to gather this information.
I am currently using the following code:
Set colProcessList = objWMIService.ExecQuery ("Select * from
Win32_Process Where Name = 'myprogram.exe'")
if colProcessList.count > 0 then
Set colProcessList2 = objWMIService.ExecQuery ("Select * from
Win32_Process Where Name = 'iexplore.exe'")
if colProcessList2.count > 0 then
objProcess2.Terminate() *******
end if
end if
what I would like to do is change the line marked with ******* to
something like this:
if title is not <blah> or url is not <xyz.com> then
objProcess2.Terminate()
end if
I can obviously get the process id, is there any way to use that to
gather the necessary information?
Any thoughts?
One other fringe benefit of this approach is that if you ever move to tabbed
browsers, this code isn't going to break due to accidentally close the
hidden "parent" IE container.
To adapt it to your situation, you probably want to use another loop like
the one that checks for "file:", only using a short unique initial substring
that identifies the site you don't mind leaving open.
set sa = CreateObject("Shell.Application")
Set windows = sa.Windows()
for each window in sa.windows
if left(window.LocationUrl, 5) <> "file:" then
' logic for selecting windows goes here
if window.locationUrl = "about:blank" then window.Quit()
end if
next
<roger...@gmail.com> wrote in message
news:7133fdf5-805b-4f1b...@j12g2000vbl.googlegroups.com...