It's me again with another question on this topic (this will be my 3rd post on it)
I have the this code (given by Tsuji), which is suppose to get a handle on an already existsing instance of IE (given its current URL), and it works quite well, however, it has this little quirk: If there's a folder window open, it will get the handle on that, rather than IE. It will work fine if there isn't a folder window open, even if there are many IE instances running. It's quite odd actually.
Thanks for the read.
I have the this code (given by Tsuji), which is suppose to get a handle on an already existsing instance of IE (given its current URL), and it works quite well, however, it has this little quirk: If there's a folder window open, it will get the handle on that, rather than IE. It will work fine if there isn't a folder window open, even if there are many IE instances running. It's quite odd actually.
Code:
sURL="[URL unfurl="true"]http://www.google.com/"[/URL]
set oie=nothing
set shapp=createobject("shell.application")
on error resume next
for each owin in shapp.windows
if strcomp(sURL,owin.document.location.href,1)=0 then
wscript.echo owin.document.location.href
set oie=owin
end if
next
on error goto 0
set owin=nothing : set shapp=nothing
if not oie is nothing then
'here you have got the searched object
'and can manipulate it, for instance navigate.
oie.navigate "[URL unfurl="true"]www.microsoft.com"[/URL]
end if
set oie=nothing
Thanks for the read.