how to identify IE7 tab with focus using objShell.windows code

the (winbatch) code below enumerates all instances if Internet explorer. Is there a property I can test to see which IE TAB has focus ?

objShell = ObjectCreate("Shell.Application")
ca_shcnt = objShell.windows.count
For x = 0 To ca_shcnt - 1
   objWindow = objShell.windows.item(x)
   If !objWindow Then Continue
   ca_shwfnam = objWindow.fullname
   If StrIndexNC(ca_shwfnam,"iexplore.exe",1,@FWDSCAN) Then
      WTtext = objWindow.document.title
      DMtext = objWindow.document.URL
   endif
Next

objWindow = 0
objShell = 0
mdlinesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gemartiCommented:
The current scripting model does not expose tab focus information. The scripting model was created before IE7 was developed thus you can't do this.

Please see:
Shell Object http://msdn.microsoft.com/en-us/library/bb774094%28v=VS.85%29.aspx
InternetExplorer Object http://msdn.microsoft.com/en-us/library/aa752084%28VS.85%29.aspx

At the bottom of each of these pages you will see a table called "Object Information" which tells you the minimum support clients

+++++++
This script will give you the information on all the tabs open but you can't tell which has focus. I know this isn't what you wanted to hear but until Microsoft's scripting team catches up with the Internet Exploprer team I don't believe it's possible to do what you want.



set shell = CreateObject("WScript.Shell")
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows


For i = 0 to objShellWindows.Count - 1
    Set objIE = objShellWindows.Item(i)
    if objIE.LocationURL <> "" Then


    WScript.echo "_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*"
   
    WScript.Echo "Frame Name: " & objIE.Name
    WScript.echo "Location URL: " & objIE.LocationURL
    Wscript.echo "Location Name: " & objIE.LocationName

    WScript.echo "_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*"

    end if
Next
mdlinesAuthor Commented:
Thanks gemarti - I suspected that this migth be the case from my own extensive research and it is good to hear it from someone else.  I have actually just thought of a partial solution ( this often happens when one asks the question in writing I find (in life)) . The solution is to enumerate the active windows and any IE windows will correspond to the tab in focus.

I will award you 200 points if thats OK ?
gemartiCommented:
Or you could just ask to have the question closed.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.