magnifier512 Posted July 30, 2009 Share Posted July 30, 2009 What I am looking for is a secure way to get the currently selected tab in an IE-Browser. I've searched the forum for several hours but could find a satisfying solution. I tried checking for the active tab with WinGetState but it didn't work, because all my tabs have the same title and it returns the state of the first tab. Then I tried to set the titles of the tabs so that they are unique, witch brought me to believe WinGetState is useless on IE-Tabs because I always got a 7 form WinGetState. Func _active_tab() $o_Shell = ObjCreate("Shell.Application") $ies = $o_Shell.Windows(); collection of all ShellWindows (IE and File Explorer) $count = 1 For $oBrowser In $ies If _IEPropertyGet($oBrowser, "title") = "" Then ContinueLoop;my tabss do have a title $oBrowser.document.title = $count sleep(500) If BitAND(WinGetState($count), 8) <> 0 Then MsgBox(0,$count, WinGetState($count) & @LF & _IEPropertyGet($oBrowser, "locationurl")) Return $oBrowser EndIf $count += 1 Next EndFunc Link to comment Share on other sites More sharing options...
DaleHohm Posted August 4, 2009 Share Posted August 4, 2009 IE works hard to hide the fact that a browser instance is in a tab (presumably for security reasons). In many cases you may be able to compare the windowtitle to the title since the windowtitle typically changes and includes the active document title at the beginning of the string. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
magnifier512 Posted August 4, 2009 Author Share Posted August 4, 2009 (edited) Thx. At least I know now that this is an unwanted feature. To look for a certain title won't help, because in my case the windows/tabs realy do have the same. And even if not. What I tried to create are Buttons which navigate to certain pages in the active tab almost like bookmarks. Well, I guess I can stop working on this particular project then. Edited August 4, 2009 by magnifier512 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now