Windows Vista Forums

Is there a way to switch between IE tabs?

  1. #1


    MG Guest

    Is there a way to switch between IE tabs?

    Hi:
    I opened a few tabs in IE8 with PowerShell

    $ie = New-Object -ComObject InternetExplorer.Application
    $ie.Visible = $true
    $ie.Navigate("http://intra.tcs.com")
    $ie.Navigate("http://www.g.com",0x0800)
    $ie.Navigate("http://support.dell.com.cn",0x0800)



    Can I switch between these tabs using PoS?

    Thanks!

    MG



      My System SpecsSystem Spec

  2. #2


    Marco Shaw [MVP] Guest

    Re: Is there a way to switch between IE tabs?

    Checking the documentation:
    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

    There's a "TargetFrameName" parameter to Navigate2 and Navigate, but I can't
    figure out how to use it...

    Marco

    "MG" <mike99@xxxxxx> wrote in message
    news:uDPe#MmFKHA.4280@xxxxxx

    > Hi:
    > I opened a few tabs in IE8 with PowerShell
    >
    > $ie = New-Object -ComObject InternetExplorer.Application
    > $ie.Visible = $true
    > $ie.Navigate("http://intra.tcs.com")
    > $ie.Navigate("http://www.g.com",0x0800)
    > $ie.Navigate("http://support.dell.com.cn",0x0800)
    >
    > Can I switch between these tabs using PoS?
    >
    > Thanks!
    >
    > MG
    >
    >

      My System SpecsSystem Spec

  3. #3


    Robert Aldwinckle Guest

    Re: Is there a way to switch between IE tabs?

    "MG" <mike99@xxxxxx> wrote in message news:uDPe#MmFKHA.4280@xxxxxx

    > Hi:
    > I opened a few tabs in IE8 with PowerShell
    >
    > $ie = New-Object -ComObject InternetExplorer.Application
    > $ie.Visible = $true
    > $ie.Navigate("http://intra.tcs.com")
    > $ie.Navigate("http://www.g.com",0x0800)
    > $ie.Navigate("http://support.dell.com.cn",0x0800)
    >

    > Can I switch between these tabs using PoS?

    Use SendKeys("Ctrl+Tab")? ; )

    Or if you want to open a specific tab n from the first 9:
    SendKeys("Ctrl+" n)


    Note: the above is pseudocode. I don't know the
    proper syntax or supporting infrastructure to actually
    do this in PowerShell... ; )

    So see perhaps...

    http://www.microsoft.com/technet/scr...hsendkeys.mspx

    (Microsoft search for
    sendkeys powershell
    )


    Good luck

    Robert Aldwinckle
    ---


    >
    > Thanks!
    >
    > MG
    >
    >


      My System SpecsSystem Spec

  4. #4


    Alex K. Angelopoulos Guest

    Re: Is there a way to switch between IE tabs?

    Could you clarify your question a bit? Do you mean:

    (1) How do I bring a particular tab to the front so it¡¯s visible?
    or
    (2) How do I connect to a particular Internet Explorer window when I have
    several open?

    For (1), there's no easy way to guarantee this; there _are_ possible hacks.
    Everyone hates SendKeys because of its poor reliability, but using that (or
    possibly some exposed elements of the free AutoItX component) is probably
    the most straightforward way. The new IE method Marco mentioned suggests
    another possible solution if frame can be determined, since you could
    actually renavigate the top frame to a particular site.

    For (2), you _can_ do this, but you need to go in another way. What you've
    done using the 0x800 flag ( - a clever trick, by the way! ) is open a NEW
    Internet Explorer instance using your original IE as a "starter". The
    original IE and all new instances are actually equal children of a global
    container IE, and you do NOT currently have a direct connection to the other
    IE windows. You basically spun them off.

    However, you can use the Shell.Application COM object to get all desktop
    shell windows, which include all IE windows. With a bit of filtering, you
    can get only the IE instances connected to non-file resources into a set
    like this:

    $ieSet = (New-Object -ComObject Shell.Application).Windows() |
    ? {$_.LocationUrl -notlike "file:*"} | ? {$_.LocationUrl}

    Note that if you DO want to include local files opened in IE, you can drop
    the first filter.

    The next thing you need to do is select the IE of interest based on the URL.
    Here's where you may encounter a problem: there is NO guarantee that the URL
    you end up at is identical to the one you chose to navigate to. For example,
    when I use
    http://support.dell.com.cn
    I end up at the URL
    http://support.ap.dell.com/support/index.aspx?c=cn&l=zh
    However, if you know something certain to be in the particular URL of
    interest, you can use it to select the correct URL:

    $ieSet | ?{$_.LocationUrl -like "*.dell.*"}

    You can also view the titles and URLs pretty quickly for interactive use
    like this:

    $ieSet | select LocationUrl,LocationName

    Another option to consider is to just go ahead and create a new IE for each
    window instead. This ensures you know which IE is important, even if it was
    redirected. For example, do this:

    function New-IE($url)
    {
    $ie = New-Object -ComObject InternetExplorer.Application
    $ie.Visible = $true;
    $ie.Navigate($url);
    $ie;
    }

    $ieTcs = New-IE http://intra.tcs.com
    $ieG = New-IE http://www.g.com
    $ieDell = New-Ie http://support.dell.com.cn


    "MG" <mike99@xxxxxx> wrote in message
    news:uDPe#MmFKHA.4280@xxxxxx

    > Hi:
    > I opened a few tabs in IE8 with PowerShell
    >
    > $ie = New-Object -ComObject InternetExplorer.Application
    > $ie.Visible = $true
    > $ie.Navigate("http://intra.tcs.com")
    > $ie.Navigate("http://www.g.com",0x0800)
    > $ie.Navigate("http://support.dell.com.cn",0x0800)
    >
    > Can I switch between these tabs using PoS?
    >
    > Thanks!
    >
    > MG
    >
    >

      My System SpecsSystem Spec

  5. #5


    MG Guest

    Re: Is there a way to switch between IE tabs?

    Thank you very much for the details explanation. I think (2) is match my
    requirement.

    MG

    "Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com>
    wrote in message news:e9EdW1wFKHA.2376@xxxxxx

    > Could you clarify your question a bit? Do you mean:
    >
    > (1) How do I bring a particular tab to the front so it¡¯s visible?
    > or
    > (2) How do I connect to a particular Internet Explorer window when I have
    > several open?
    >
    > For (1), there's no easy way to guarantee this; there _are_ possible
    > hacks. Everyone hates SendKeys because of its poor reliability, but using
    > that (or possibly some exposed elements of the free AutoItX component) is
    > probably the most straightforward way. The new IE method Marco mentioned
    > suggests another possible solution if frame can be determined, since you
    > could actually renavigate the top frame to a particular site.
    >
    > For (2), you _can_ do this, but you need to go in another way. What you've
    > done using the 0x800 flag ( - a clever trick, by the way! ) is open a NEW
    > Internet Explorer instance using your original IE as a "starter". The
    > original IE and all new instances are actually equal children of a global
    > container IE, and you do NOT currently have a direct connection to the
    > other IE windows. You basically spun them off.
    >
    > However, you can use the Shell.Application COM object to get all desktop
    > shell windows, which include all IE windows. With a bit of filtering, you
    > can get only the IE instances connected to non-file resources into a set
    > like this:
    >
    > $ieSet = (New-Object -ComObject Shell.Application).Windows() |
    > ? {$_.LocationUrl -notlike "file:*"} | ? {$_.LocationUrl}
    >
    > Note that if you DO want to include local files opened in IE, you can drop
    > the first filter.
    >
    > The next thing you need to do is select the IE of interest based on the
    > URL. Here's where you may encounter a problem: there is NO guarantee that
    > the URL you end up at is identical to the one you chose to navigate to.
    > For example, when I use
    > http://support.dell.com.cn
    > I end up at the URL
    > http://support.ap.dell.com/support/index.aspx?c=cn&l=zh
    > However, if you know something certain to be in the particular URL of
    > interest, you can use it to select the correct URL:
    >
    > $ieSet | ?{$_.LocationUrl -like "*.dell.*"}
    >
    > You can also view the titles and URLs pretty quickly for interactive use
    > like this:
    >
    > $ieSet | select LocationUrl,LocationName
    >
    > Another option to consider is to just go ahead and create a new IE for
    > each window instead. This ensures you know which IE is important, even if
    > it was redirected. For example, do this:
    >
    > function New-IE($url)
    > {
    > $ie = New-Object -ComObject InternetExplorer.Application
    > $ie.Visible = $true;
    > $ie.Navigate($url);
    > $ie;
    > }
    >
    > $ieTcs = New-IE http://intra.tcs.com
    > $ieG = New-IE http://www.g.com
    > $ieDell = New-Ie http://support.dell.com.cn
    >
    >
    > "MG" <mike99@xxxxxx> wrote in message
    > news:uDPe#MmFKHA.4280@xxxxxx

    >> Hi:
    >> I opened a few tabs in IE8 with PowerShell
    >>
    >> $ie = New-Object -ComObject InternetExplorer.Application
    >> $ie.Visible = $true
    >> $ie.Navigate("http://intra.tcs.com")
    >> $ie.Navigate("http://www.g.com",0x0800)
    >> $ie.Navigate("http://support.dell.com.cn",0x0800)
    >>
    >> Can I switch between these tabs using PoS?
    >>
    >> Thanks!
    >>
    >> MG
    >>
    >>

      My System SpecsSystem Spec

Is there a way to switch between IE tabs?

Similar Threads
Thread Thread Starter Forum Replies Last Post
tabs cazxx1 Vista General 1 02 Oct 2009
HomePage Tabs >Why is it limited to 8 tabs ??? Vista General 3 06 Nov 2007
tabs bigdaddy55513 Vista security 3 18 Oct 2007
Tabs in I E CARMAN HERE. NEEDS HELP. THANKS Vista General 3 20 Apr 2007
IE7 Tabs shablap Vista General 0 15 Apr 2007