Internet Explorer 8 Tab problem

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
buda56
Junior Coder
Posts: 20
Joined: Thu Aug 07, 2008 10:45 am

Internet Explorer 8 Tab problem

Post by buda56 » Wed Sep 09, 2009 11:09 am

Hi,
I have been using Avant web browser and my script has functioned okay when trying to switch tabs from one window in the browser to another.

Tonight I setup Internet explorer 8 and tried running my script against it to find different tabs in the ie8 browser window. For instance I have been using the SetFocus function to set focus to the particular tab that I wanted, I have noted now that when I try to use the SetFocus method it cannot see the required window in ie8, all it can see is the currently focused window.

I also tried looking at the "view system windows" under the Tools menu option of the Macro editor and it also only sees the currently focused window of ie8 and no others.

How can I find and focus the tab I require in ie8??

Regards.
Peter.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 09, 2009 12:41 pm

As with all (well, all standard) tab controls you can select them with CTRL-TAB. You can cycle through each tab with CTRL-TAB.

So changing tabs is easy and I suppose what you really want to know is how to select the one you want, or looking at it another way, how to know the current tab is the one you want to stop at. I can see a number of ways to do that.

You can select the text in the address bar with ALT-D. So you could have a loop which does CTRL-TAB, ALT-D, copy to clipboard (CTRL-C), GetClipBoard and checks if it's the one you want, stops if so, keeps looping otherwise.

Or you might use GetWindowTextEx or similar to find some text on the page to see if it's the page you want and stop looping.

Or image recognition

Or use DDE to get the current URL and page title:

DDERequest>IExplore,WWW_GetWindowInfo,0xFFFFFFFF,ret,10

That's nice as it gets the current page details in one line of code. So you could, e.g. do:

Code: Select all

Let>page_I_want=http://www.mjtnet.com/
SetFocus>Windows Internet Explorer*
Label>tab_select
DDERequest>IExplore,WWW_GetWindowInfo,0xFFFFFFFF,ret,10
Pos>page_I_want,ret,1,p
If>p>0
  //stop
Else
  Press CTRL
  Press Tab
  Release CTRL
  Wait>0.5
  Goto>tab_select
Endif
Just an example of one approach that might work.

HTH
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

buda56
Junior Coder
Posts: 20
Joined: Thu Aug 07, 2008 10:45 am

Post by buda56 » Sun Sep 13, 2009 9:38 am

Marcus,
Thanks for the inforation, I haven't had a chance to implement as yet as I have had other problems that have preculded me from using IE8.

Thanks for the information.

Regards..
Peter.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts